@readmagic/workmate 0.0.12 → 0.0.14
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-m2d3nOQJ.js +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-BRXGkHO4.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-_yJJ0wqu.js → AgentsMdExternalIncludesDialog-D58Vn3SK.js} +1 -1
- package/dist/chunks/App-CeC-2dzL.js +1 -0
- package/dist/chunks/ApproveApiKey-DFpddLyp.js +1 -0
- package/dist/chunks/ApproveApiKey-NXTWIAMj.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-9ruzl1jm.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-COI_V57z.js → BypassPermissionsModeDialog-C4QGpcBT.js} +1 -1
- package/dist/chunks/DiffDialog-LTdtTqsC.js +6 -0
- package/dist/chunks/Doctor-DmiDH-lg.js +1 -0
- package/dist/chunks/Doctor-Yvrzcrvx.js +3 -0
- package/dist/chunks/ExitFlow-DH0L3tyY.js +2 -0
- package/dist/chunks/{Grove-DRZrhbF0.js → Grove-BhhnrFX9.js} +2 -2
- package/dist/chunks/{HybridTransport-BadJQe6u.js → HybridTransport-CEWG9ZRi.js} +2 -4
- package/dist/chunks/InvalidConfigDialog-Ue3kJUPJ.js +1 -0
- package/dist/chunks/InvalidSettingsDialog-BO2AOTVf.js +1 -0
- package/dist/chunks/MCPConnectionManager-Ciy9y9VV.js +1 -0
- package/dist/chunks/MCPToolListView-Ddmu2UcL.js +1 -0
- package/dist/chunks/{McpParsingWarnings-xv0RZCSL.js → McpParsingWarnings-BsCDFWci.js} +1 -1
- package/dist/chunks/MessageSelector-DY5K0NHd.js +3 -0
- package/dist/chunks/Messages-LD6ZO301.js +10 -0
- package/dist/chunks/Onboarding-w0-VVsDz.js +1 -0
- package/dist/chunks/PermissionDialog-BPhvs5xH.js +1 -0
- package/dist/chunks/PressEnterToContinue-Dwoh6CaW.js +1 -0
- package/dist/chunks/{PromptInputFooterSuggestions-8-awCxOn.js → PromptInputFooterSuggestions-OEXx0Abp.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-DyaUsvNx.js +1 -0
- package/dist/chunks/QueryEngine-sH-KjJIq.js +1 -0
- package/dist/chunks/REPL-BMH_RItw.js +128 -0
- package/dist/chunks/REPL-DkPd3vk5.js +1 -0
- package/dist/chunks/{RemoteSessionManager-B4jqKVd3.js → RemoteSessionManager-DJhrR1dz.js} +2 -2
- package/dist/chunks/ResumeConversation-BbNrpSFB.js +1 -0
- package/dist/chunks/SSETransport-CLiI2qnD.js +2 -0
- package/dist/chunks/{SearchBox-C9vUA4IM.js → SearchBox-CwwV0W-w.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-DupzA6Vm.js +1 -0
- package/dist/chunks/Settings-B1EI5LOU.js +2 -0
- package/dist/chunks/{TeleportProgress-zmdAsogZ.js → TeleportProgress-IB--CbqZ.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-CG32I4cO.js → TeleportRepoMismatchDialog-KjdlS_gA.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-2Yjr74Lq.js → TeleportResumeWrapper-DnHTI39O.js} +1 -1
- package/dist/chunks/ThemePicker-BrD_T7xF.js +1 -0
- package/dist/chunks/{TrustDialog-BVcny9vs.js → TrustDialog-L0rvvpit.js} +1 -1
- package/dist/chunks/ValidationErrorsList-QZvtUrAy.js +2 -0
- package/dist/chunks/add-dir-CpWXReCi.js +1 -0
- package/dist/chunks/{agentDisplay-CfMLGPGH.js → agentDisplay-CrQvGkTT.js} +1 -1
- package/dist/chunks/agents-BYQO6DbG.js +101 -0
- package/dist/chunks/{agents-BT82hwBN.js → agents-C99yMsVF.js} +1 -1
- package/dist/chunks/allErrors-uyOMiF9U.js +1 -0
- package/dist/chunks/{api-DAubp5q9.js → api-C5I2xwgd.js} +1 -1
- package/dist/chunks/api-j0iE1mkR.js +1 -0
- package/dist/chunks/attributionHooks-C0aXyx9L.js +1 -0
- package/dist/chunks/{auth-yDsvFcM7.js → auth-BYCRa_mb.js} +7 -12
- package/dist/chunks/auth-C9FUZzpW.js +1 -0
- package/dist/chunks/auth-DwPrlTHv.js +1 -0
- package/dist/chunks/backgroundHousekeeping-BxcVB3By.js +1 -0
- package/dist/chunks/backgroundHousekeeping-CjD8bACB.js +17 -0
- package/dist/chunks/{banner-BcAM7iSx.js → banner-HfMnBd03.js} +2 -2
- package/dist/chunks/{bg-Ci7pG4eo.js → bg-DltfF1_K.js} +2 -2
- package/dist/chunks/branch-BOWBZo5K.js +2 -0
- package/dist/chunks/{break-cache-4rlQORVk.js → break-cache-Cd1yQ-0h.js} +2 -3
- package/dist/chunks/bridgeConfig-Bxs5dqjH.js +1 -0
- package/dist/chunks/{bridgeConfig-BB6Hgali.js → bridgeConfig-CgAVrQfz.js} +1 -1
- package/dist/chunks/{bridgeMessaging-C9D0Lly2.js → bridgeMessaging-cOFtbkf_.js} +1 -1
- package/dist/chunks/{bridgePointer-DHWK3LEe.js → bridgePointer-CiHy2tTN.js} +1 -1
- package/dist/chunks/{bridgeStatusUtil-D8UbcVrZ.js → bridgeStatusUtil-BQF0AJDO.js} +1 -1
- package/dist/chunks/btw-B0UmiVKl.js +1 -0
- package/dist/chunks/caches-C9--b9a7.js +1 -0
- package/dist/chunks/caches-wN3JyvNE.js +1 -0
- package/dist/chunks/{capacityWake-ByL6fM6I.js → capacityWake-LRiPhPeM.js} +1 -1
- package/dist/chunks/{ccrClient-BG9HU_fW.js → ccrClient-wtUIz75R.js} +1 -1
- package/dist/chunks/{claudeDesktop-Ct_hyICL.js → claudeDesktop-DPIJpc1V.js} +1 -1
- package/dist/chunks/{clear-B4XN2fib.js → clear-CNzBoL7O.js} +1 -1
- package/dist/chunks/{cliLaunch-OPOtzhvA.js → cliLaunch-xIVvtPZy.js} +1 -1
- package/dist/chunks/{client-BMA05FW8.js → client-B7WkO81L.js} +1 -1
- package/dist/chunks/client-BCzhAEd0.js +1 -0
- package/dist/chunks/client-Dr9AYB-r.js +1 -0
- package/dist/chunks/commands-DTB0Qzd5.js +1 -0
- package/dist/chunks/compact-Bj8mdDYN.js +2 -0
- package/dist/chunks/config-B1kYcRIP.js +1 -0
- package/dist/chunks/{config-9rLTDOYW.js → config-BkbL2e5Q.js} +1 -1
- package/dist/chunks/{config-DMKtiMzJ.js → config-WMxn2jLl.js} +1 -1
- package/dist/chunks/context-DB1Ar85E.js +1 -0
- package/dist/chunks/context-noninteractive-Bno2Xsmp.js +1 -0
- package/dist/chunks/{context-noninteractive-mAQt1p9l.js → context-noninteractive-CqnJTDcI.js} +2 -2
- package/dist/chunks/conversation-DOgBzrm0.js +1 -0
- package/dist/chunks/conversation-hNXWaswI.js +1 -0
- package/dist/chunks/{createSSHSession-DjLSGm-0.js → createSSHSession-Cf2tOgK_.js} +3 -4
- package/dist/chunks/createSession-BZx-2UIB.js +1 -0
- package/dist/chunks/{createSession-CftIZ3aq.js → createSession-DD5YaQKM.js} +1 -1
- package/dist/chunks/crossProjectResume-CkiPQYYE.js +40 -0
- package/dist/chunks/{datadog-BGati3aQ.js → datadog-DcLf1QpG.js} +1 -1
- package/dist/chunks/{debug-Dr1SjdXn.js → debug-BQj6h99Q.js} +1 -1
- package/dist/chunks/debugUtils-B86DM1Sp.js +1 -0
- package/dist/chunks/{detached-CqfQYVOi.js → detached--wGwkuHX.js} +1 -2
- package/dist/chunks/{detectRepository-CMEkS5_2.js → detectRepository-Qy3zKoyn.js} +1 -1
- package/dist/chunks/detectRepository-tRUoPOKy.js +1 -0
- package/dist/chunks/{diff-1HsxKGBh.js → diff-dfXWiuLA.js} +1 -1
- package/dist/chunks/directoryCompletion-BtlRKLzw.js +1 -0
- package/dist/chunks/doctor-aKE2bG5C.js +1 -0
- package/dist/chunks/entry-wISucmYc.js +13 -0
- package/dist/chunks/esm-CrJVXrKW.js +1 -0
- package/dist/chunks/{execFileNoThrow-mXq4K0rl.js → execFileNoThrow-DYm1GeGn.js} +1 -1
- package/dist/chunks/{execSyncWrapper-Ne33rRiD.js → execSyncWrapper-CqvQqke-.js} +1 -1
- package/dist/chunks/exit-pjN4EJHV.js +1 -0
- package/dist/chunks/exit-s9XGerrH.js +1 -0
- package/dist/chunks/{extraUsage-0pUcYexI.js → extraUsage-CwDhpClH.js} +1 -1
- package/dist/chunks/extractMemories-WmPLOLUT.js +1 -0
- package/dist/chunks/fast-BVABmasw.js +1 -0
- package/dist/chunks/fast-Cuj3bfFm.js +1 -0
- package/dist/chunks/{fileSuggestions-Be-pyLLq.js → fileSuggestions-Dy2BUZzd.js} +2 -2
- package/dist/chunks/firstPartyEventLogger-CabA8fu0.js +1 -0
- package/dist/chunks/{firstPartyEventLogger-aFhcruXA.js → firstPartyEventLogger-D4yuDP-n.js} +3 -5
- package/dist/chunks/flushGate-B6ecrC4j.js +1 -0
- package/dist/chunks/{fpsMetrics-DffAomdg.js → fpsMetrics-Dk_pnSHJ.js} +1 -1
- package/dist/chunks/gemini-BC-BxZmj.js +1 -0
- package/dist/chunks/generateSessionName-JTR8nPYD.js +1 -0
- package/dist/chunks/{genericProcessUtils-Dc1pfb7J.js → genericProcessUtils-Bbcbi11g.js} +1 -1
- package/dist/chunks/git-BaSq69E7.js +1 -0
- package/dist/chunks/{git-CoQQ6YEf.js → git-DplvjXEY.js} +2 -3
- package/dist/chunks/{githubRepoPathMapping-CmpEaQoo.js → githubRepoPathMapping-Bk4FZrng.js} +1 -1
- package/dist/chunks/goal-B09SOyra.js +3 -0
- package/dist/chunks/grok-BBo3jGfP.js +1 -0
- package/dist/chunks/{grove-BnzBbGsX.js → grove-DsAIY-rZ.js} +1 -1
- package/dist/chunks/help-CELr6oJZ.js +1 -0
- package/dist/chunks/hooks-9rkDD2iw.js +1 -0
- package/dist/chunks/{hooks-BZS105Rd.js → hooks-BI4NY5IC.js} +2 -2
- package/dist/chunks/initReplBridge-BYrL6ou1.js +1 -0
- package/dist/chunks/{install-NZvHd_40.js → install-Dn3_M1Ui.js} +1 -1
- package/dist/chunks/{instrumentation-CjBlVlFq.js → instrumentation-5cSwEKaF.js} +4 -4
- package/dist/chunks/{job-D502Zf8J.js → job-rW1mEYtm.js} +1 -1
- package/dist/chunks/{jwtUtils-FQWtM6iM.js → jwtUtils-YCoZL0FW.js} +1 -1
- package/dist/chunks/keybindings-B5kUoxvg.js +1 -0
- package/dist/chunks/{launchLocalMemory-DxC3LojF.js → launchLocalMemory-CPucX8Xj.js} +2 -2
- package/dist/chunks/launchOnboarding--GCJWeeS.js +8 -0
- package/dist/chunks/loadAgentsDir-D-a1uUb5.js +1 -0
- package/dist/chunks/{loadAgentsDir-BXtV2jiO.js → loadAgentsDir-JrGMJN05.js} +659 -697
- package/dist/chunks/loadPluginHooks-C4zrlV0u.js +1 -0
- package/dist/chunks/localSearch-C-stDP9C.js +1 -0
- package/dist/chunks/localSearch-hOERAH9v.js +1 -0
- package/dist/chunks/{log-27kCA_9u.js → log-BlJ7CcKG.js} +1 -1
- package/dist/chunks/{logoV2Utils-CEnU8qad.js → logoV2Utils-J2Sqfube.js} +1 -1
- package/dist/chunks/{magicDocs-YtfrqVC6.js → magicDocs-Dpe3YhyL.js} +2 -2
- package/dist/chunks/main-C_PDzJdv.js +356 -0
- package/dist/chunks/{main-CGLCy2pM.js → main-Zh18lf2J.js} +2 -2
- package/dist/chunks/managedEnv-AEhH_HUs.js +1 -0
- package/dist/chunks/{managedEnv-B-BNY0xC.js → managedEnv-C8SisyLk.js} +1 -1
- package/dist/chunks/{mappers-IuJeXgvr.js → mappers-CMJorgSL.js} +1 -1
- package/dist/chunks/mcp-B2mJmWKt.js +6 -0
- package/dist/chunks/mcp-SuAh71Ht.js +2 -0
- package/dist/chunks/mcp-_tBxhPV-.js +1 -0
- package/dist/chunks/{memoize-Co4vS6UF.js → memoize-_2f7NWDv.js} +1 -1
- package/dist/chunks/memory-DK8bOrUr.js +1 -0
- package/dist/chunks/{modalContext-CUThy6Ph.js → modalContext-wY9CeN4G.js} +1 -1
- package/dist/chunks/{mode-GzBwK--u.js → mode-BhfhEpnW.js} +2 -2
- package/dist/chunks/model-BCM7RpVk.js +1 -0
- package/dist/chunks/model-BWR43D3c.js +1 -0
- package/dist/chunks/model-CmDF8O9G.js +1 -0
- package/dist/chunks/modelOptions-DEQat7lU.js +1 -0
- package/dist/chunks/nativeInstaller-xxyUjXbl.js +1 -0
- package/dist/chunks/{omit-D4Udf-p-.js → omit-od_CYp5o.js} +1 -1
- package/dist/chunks/{onChangeAppState-WbvtqDtk.js → onChangeAppState-CqTb0yEa.js} +1 -1
- package/dist/chunks/{openai-DaVFXyBB.js → openai-qW8mATAs.js} +3 -3
- package/dist/chunks/{panel-CoF2a-h4.js → panel-Bg_0PHE6.js} +1 -1
- package/dist/chunks/{parser-CUUiH40T.js → parser-a2S_eFyE.js} +1 -1
- package/dist/chunks/parser-x-w3ikxt.js +1 -0
- package/dist/chunks/{partition-CzW_31Y1.js → partition-CYoWXLNU.js} +1 -1
- package/dist/chunks/permissions--iKUbWBw.js +3 -0
- package/dist/chunks/pidLock-BR4hzYgp.js +3 -0
- package/dist/chunks/plan-DiHCGXhM.js +1 -0
- package/dist/chunks/{platform-Dg1c9F_1.js → platform-DVeTi9mp.js} +2 -2
- package/dist/chunks/plugin-BeC4D7XF.js +17 -0
- package/dist/chunks/pluginAutoupdate-Bj-CrFuO.js +1 -0
- package/dist/chunks/pluginBlocklist-DzOs-RS1.js +1 -0
- package/dist/chunks/pluginCliCommands-DwIGn58t.js +1 -0
- package/dist/chunks/{pluginFlagging-CXSSOj4J.js → pluginFlagging-BzuymJuf.js} +1 -1
- package/dist/chunks/pluginOperations-CP1v-nu0.js +2 -0
- package/dist/chunks/pluginStartupCheck-BGN6Je6d.js +1 -0
- package/dist/chunks/{pluginStartupCheck-BEd0VeQC.js → pluginStartupCheck-BUeBiYVq.js} +1 -1
- package/dist/chunks/plugins-D1N31THW.js +4 -0
- package/dist/chunks/{poorMode-DxgO_bUb.js → poorMode-D4L_-yWS.js} +1 -1
- package/dist/chunks/poorMode-XDBnxTiF.js +1 -0
- package/dist/chunks/print-DaJi1wF_.js +14 -0
- package/dist/chunks/processBashCommand-BGCIqxc9.js +1 -0
- package/dist/chunks/processSlashCommand-qR_j1DE8.js +5 -0
- package/dist/chunks/prompt-B0gADAvI.js +1 -0
- package/dist/chunks/{prompt-CRc2QEZ5.js → prompt-DnPppVz8.js} +21 -23
- package/dist/chunks/prompt-DqyEtC_I2.js +1 -0
- package/dist/chunks/{promptEditor-Bo1d8ZLq.js → promptEditor-Cilc9N3L.js} +3 -3
- package/dist/chunks/protocolHandler-DdbiucQa.js +13 -0
- package/dist/chunks/{proxy-BEKNaTXI.js → proxy-C0j74LqT.js} +1 -1
- package/dist/chunks/reconciler-Bte4gdP-.js +1 -0
- package/dist/chunks/refresh-MiZ0acBm.js +1 -0
- package/dist/chunks/registerProtocol-Bpte9dly.js +1 -0
- package/dist/chunks/{reload-plugins-DNEgQ5vo.js → reload-plugins-GdqFZblC.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-BGOqHADF.js → remoteBridgeCore-CAl3_H-O.js} +1 -1
- package/dist/chunks/{remoteManagedSettings-26nhzuca.js → remoteManagedSettings-BcLJLEr7.js} +1 -1
- package/dist/chunks/rename-BDo5qIK0.js +1 -0
- package/dist/chunks/{renderOptions-45A-EdsK.js → renderOptions-CkqTbz6d.js} +1 -1
- package/dist/chunks/resume-Bbweh2hA.js +2 -0
- package/dist/chunks/ripgrep-DrpZ79Pp.js +1 -0
- package/dist/chunks/{ripgrep-DQ_ILUJV.js → ripgrep-X5m4gJ-3.js} +1 -1
- package/dist/chunks/{runtimeObserver-CBV-7-w7.js → runtimeObserver-CxXxUcrm.js} +1 -1
- package/dist/chunks/{runtimeObserver-BZrF3GnQ.js → runtimeObserver-Hjbo43xj.js} +3 -3
- package/dist/chunks/sandbox-adapter-DQ_fJSIo.js +1 -0
- package/dist/chunks/sandbox-toggle-DmNSThQK.js +1 -0
- package/dist/chunks/searchExtraTools-C7b2x2p_.js +1 -0
- package/dist/chunks/{session-Dy-_R7KP.js → session-CkuTMD_4.js} +2 -2
- package/dist/chunks/sessionFileAccessHooks-CQvGAbvL.js +1 -0
- package/dist/chunks/{sessionIdCompat-DMayYBrf.js → sessionIdCompat-Dgp6PW_1.js} +1 -1
- package/dist/chunks/sessionObserver-BoQY7nOa.js +1 -0
- package/dist/chunks/{sessionObserver-CyLpHSkw.js → sessionObserver-CvQ6oyoj.js} +1 -1
- package/dist/chunks/sessionState-C2REgUrs.js +11 -0
- package/dist/chunks/sessionStorage-BeaEgnaa.js +1 -0
- package/dist/chunks/sessionStoragePortable-x0Yn02-G.js +3 -0
- package/dist/chunks/{sessionTitle-L5tyJgdU.js → sessionTitle-2IWcNB8H.js} +2 -2
- package/dist/chunks/{sessionTracing-DpHGGIZm.js → sessionTracing-Bm7hQKHA.js} +2 -2
- package/dist/chunks/settings-Da6ax5aI.js +1 -0
- package/dist/chunks/{settings-DiBMs2gM.js → settings-aUygByiZ.js} +4 -5
- package/dist/chunks/settingsSync-DgzCU1BZ.js +1 -0
- package/dist/chunks/setup-CvaG4nl5.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-DZ0AA2Rw.js → shadowedRuleDetection-CWCQ5dZ0.js} +1 -1
- package/dist/chunks/{shellQuote-C_I6DHLV.js → shellQuote-D3Ocv_U-.js} +1 -1
- package/dist/chunks/{sideQuestion-BYT8FdPF.js → sideQuestion-BoW-xYkh.js} +3 -3
- package/dist/chunks/sinks-B_ehGpvp.js +1 -0
- package/dist/chunks/sinks-ZHKfs6gv.js +1 -0
- package/dist/chunks/skillChangeDetector-C-HWR_8v.js +1 -0
- package/dist/chunks/{skillGapStore-DQXHqoP7.js → skillGapStore-CCNeSjIb.js} +2 -2
- package/dist/chunks/{skillLifecycle-BG_RnGSh.js → skillLifecycle-wU4JDNYQ.js} +2 -2
- package/dist/chunks/{skillSearchPanel-DxYP4Q6R.js → skillSearchPanel-Cxr1QQn4.js} +2 -2
- package/dist/chunks/skills-BghnKnNo.js +1 -0
- package/dist/chunks/{src-r6ZFgWPx2.js → src-D3yIF9I42.js} +1 -1
- package/dist/chunks/src-DL3w8VPk2.js +51 -0
- package/dist/chunks/{startupProfiler-Dc5r6LgE.js → startupProfiler-2sjXZkIP.js} +1 -1
- package/dist/chunks/startupProfiler-B2fyaBEa.js +1 -0
- package/dist/chunks/{staticRender-DrU6eWoq.js → staticRender-D9AbnQFr.js} +1 -1
- package/dist/chunks/{stats-BkadEKa-.js → stats-unp6R0Ah.js} +1 -1
- package/dist/chunks/{status-BmHu-c7I.js → status-BraYBx4N.js} +2 -2
- package/dist/chunks/status-DwyWiaVc.js +1 -0
- package/dist/chunks/statusNoticeHelpers-Dm1aiibR.js +1 -0
- package/dist/chunks/{stringUtils-Df-Lnjxd.js → stringUtils-BjnclTLB.js} +3 -3
- package/dist/chunks/{switcher-sYTxnJQA.js → switcher-BUNSEJ-7.js} +1 -1
- package/dist/chunks/switcher-DDUnWU_4.js +1 -0
- package/dist/chunks/{syncCache-BofuFJEe.js → syncCache-1s9xV8WV.js} +1 -1
- package/dist/chunks/tasks-BjFot03S.js +1 -0
- package/dist/chunks/teleport-Dj2Kvbmx.js +1 -0
- package/dist/chunks/{templateJobs-C94jEE6O.js → templateJobs-CY7GNRo5.js} +1 -3
- package/dist/chunks/{terminalSetup-fwhFTxGi.js → terminalSetup-CpMNk6dc.js} +5 -6
- package/dist/chunks/{terminalSetup-CbXKCpWM.js → terminalSetup-Ty8T8ePM.js} +1 -1
- package/dist/chunks/theme-c6grxWNn.js +1 -0
- package/dist/chunks/{tmux-d3cNCIZA.js → tmux-g0cQ0Buz.js} +1 -1
- package/dist/chunks/{toolEventObserver-DlL9CHmI.js → toolEventObserver-D7WbjgFR.js} +1 -1
- package/dist/chunks/toolPool-O5nkEFb1.js +1 -0
- package/dist/chunks/{trustedDevice-Bzz03jCy.js → trustedDevice-BF78PNK8.js} +1 -1
- package/dist/chunks/trustedDevice-D_z7bAQh.js +1 -0
- package/dist/chunks/{types-BJ7qTz75.js → types-BomO8WUz.js} +1 -1
- package/dist/chunks/{udsClient-CF8BmZgN.js → udsClient-DSvRPCvR.js} +1 -1
- package/dist/chunks/updateCCB-ts7Joyve.js +5 -0
- package/dist/chunks/upstreamproxy-DYoLvdM9.js +10 -0
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-qLfN0tc-.js +1 -0
- package/dist/chunks/useMainLoopModel-DkjG_ikT.js +1 -0
- package/dist/chunks/useManagePlugins-E0Qzj-ws.js +1 -0
- package/dist/chunks/useMergedTools-B7iYaNwM.js +1 -0
- package/dist/chunks/{useSearchInput-q2CFPU4W.js → useSearchInput-CsxiM9i0.js} +1 -1
- package/dist/chunks/useSettingsErrors-DdVTahNa.js +1 -0
- package/dist/chunks/{userAgent-B7WkjI6I.js → userAgent-BggRZ-ZE.js} +1 -1
- package/dist/chunks/util-Xdy1nOjj.js +1 -0
- package/dist/chunks/{validatePlugin-jrcrYEIu.js → validatePlugin-Be5aSSnP.js} +1 -1
- package/dist/chunks/{vim-C4Hs5U2h.js → vim-cFcxfuac.js} +1 -1
- package/dist/chunks/{which-mplwBbc0.js → which-BR8YVCCW.js} +1 -1
- package/dist/chunks/{windowsPaths-C7Mdo9aU.js → windowsPaths-BmXyrasP.js} +1 -1
- package/dist/chunks/windowsPaths-BybjGW7e.js +1 -0
- package/dist/chunks/{workSecret-XLodD7tw.js → workSecret-BUd8cQ6-.js} +1 -1
- package/dist/chunks/workerRegistry-GrD7IAVQ.js +2 -0
- package/dist/chunks/worktree-V7xiUAtl.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AddWorkspaceDirectory-CtRxzRny.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-_bI4jo_P.js +0 -1
- package/dist/chunks/App-DoAZ7CYS.js +0 -1
- package/dist/chunks/ApproveApiKey-C8LwmDM2.js +0 -1
- package/dist/chunks/ApproveApiKey-DQP3qmb0.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-CDA2noEk.js +0 -2
- package/dist/chunks/ConsoleOAuthFlow-Dn8fO-o_.js +0 -1
- package/dist/chunks/DiffDialog-CRWtQ1R5.js +0 -6
- package/dist/chunks/Doctor-CZ513Df9.js +0 -3
- package/dist/chunks/Doctor-CzPvNZzF.js +0 -1
- package/dist/chunks/ExitFlow-BFeftDv0.js +0 -2
- package/dist/chunks/InvalidConfigDialog-DQaT6aen.js +0 -1
- package/dist/chunks/InvalidSettingsDialog-ISzcIGPU.js +0 -1
- package/dist/chunks/MCPConnectionManager-BpjC7CEo.js +0 -1
- package/dist/chunks/MCPToolListView-Rb1Q--jG.js +0 -1
- package/dist/chunks/MessageSelector-BHB55sZb.js +0 -3
- package/dist/chunks/Messages-CPX-nIdA.js +0 -11
- package/dist/chunks/Onboarding-CymgipoF.js +0 -1
- package/dist/chunks/PermissionDialog-Cb3z8OUP.js +0 -1
- package/dist/chunks/PressEnterToContinue-Dq0Imo9c.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-BP3UgCdi.js +0 -1
- package/dist/chunks/QueryEngine-HkswHUNv.js +0 -1
- package/dist/chunks/REPL-CZfg65kg.js +0 -133
- package/dist/chunks/REPL-eZsYNBfl.js +0 -1
- package/dist/chunks/ResumeConversation-B03XN_SP.js +0 -1
- package/dist/chunks/SSETransport-je346ofV.js +0 -4
- package/dist/chunks/SearchExtraToolsTool-C85Sanww.js +0 -1
- package/dist/chunks/Settings-C8GKWod1.js +0 -2
- package/dist/chunks/ThemePicker-p7_hHk1V.js +0 -1
- package/dist/chunks/ValidationErrorsList-DSSUWdgd.js +0 -2
- package/dist/chunks/WelcomeV2-BnSYhyfu.js +0 -1
- package/dist/chunks/add-dir-Bd7pilVx.js +0 -1
- package/dist/chunks/agents-qR6r94-F.js +0 -103
- package/dist/chunks/allErrors-CS77lRvU.js +0 -1
- package/dist/chunks/api-C4VflFau.js +0 -1
- package/dist/chunks/attributionHooks-CUAoGkU6.js +0 -1
- package/dist/chunks/auth-CNCehj7y.js +0 -1
- package/dist/chunks/auth-DrD9DW6X.js +0 -1
- package/dist/chunks/autoMode-C2lnBot9.js +0 -45
- package/dist/chunks/autoModeDenials-BxNzGJdR.js +0 -1
- package/dist/chunks/backgroundHousekeeping-DbpTGbwl.js +0 -1
- package/dist/chunks/backgroundHousekeeping-SpTxViUq.js +0 -17
- package/dist/chunks/branch-DJiMa8td.js +0 -3
- package/dist/chunks/bridgeConfig-Ccm79Jze.js +0 -1
- package/dist/chunks/btw-BO2B23f-.js +0 -1
- package/dist/chunks/caches-BQmbXerw.js +0 -1
- package/dist/chunks/caches-Dtjmjm6G.js +0 -1
- package/dist/chunks/client-7lIxWcaM.js +0 -1
- package/dist/chunks/client-B-2ccQZk.js +0 -1
- package/dist/chunks/commands-D_-v6_A0.js +0 -1
- package/dist/chunks/compact-kM0ETtB2.js +0 -2
- package/dist/chunks/config-Crf6Mzu3.js +0 -1
- package/dist/chunks/connectHeadless-CqRoEtrg.js +0 -1
- package/dist/chunks/context-BY5oO5is.js +0 -1
- package/dist/chunks/context-noninteractive-tc4KTYfI.js +0 -1
- package/dist/chunks/conversation-CFIn-KsW.js +0 -1
- package/dist/chunks/conversation-DPI7VKBL.js +0 -1
- package/dist/chunks/createSession-CjdLcRec.js +0 -1
- package/dist/chunks/crossProjectResume-BJqXBzkf.js +0 -40
- package/dist/chunks/dangerousBackend-DwcP0P08.js +0 -1
- package/dist/chunks/debugUtils-cK-iOsEV.js +0 -1
- package/dist/chunks/detectRepository-BsKZDRoI.js +0 -1
- package/dist/chunks/directoryCompletion-ByBTSuLu.js +0 -1
- package/dist/chunks/doctor-CJfvt9zR.js +0 -1
- package/dist/chunks/entry-CrZCZQQC.js +0 -14
- package/dist/chunks/esm-BkOWaWVb.js +0 -1
- package/dist/chunks/exit-B8MA4Ltm.js +0 -1
- package/dist/chunks/exit-BOhGfSlm.js +0 -2
- package/dist/chunks/extractMemories-DqhN0lba.js +0 -1
- package/dist/chunks/fast-DT5WDe3L.js +0 -1
- package/dist/chunks/fast-VOu2FUlV.js +0 -1
- package/dist/chunks/firstPartyEventLogger-B8RVGBQB.js +0 -1
- package/dist/chunks/flushGate-BUSrMj_6.js +0 -1
- package/dist/chunks/gemini-DB4M-MYv.js +0 -1
- package/dist/chunks/generateSessionName-DhCypqJ_.js +0 -1
- package/dist/chunks/git-Bs1vtuvX.js +0 -1
- package/dist/chunks/goal-TxXtfkQ6.js +0 -3
- package/dist/chunks/grok-D2a_J5wE.js +0 -1
- package/dist/chunks/help-C5ankDi4.js +0 -1
- package/dist/chunks/hooks-D-twhU_z.js +0 -1
- package/dist/chunks/initReplBridge-DL4klK0C.js +0 -1
- package/dist/chunks/keybindings-D9Boc8FD.js +0 -2
- package/dist/chunks/launchOnboarding-BLp5k_H4.js +0 -8
- package/dist/chunks/loadAgentsDir-BjsAQWqt.js +0 -1
- package/dist/chunks/loadPluginHooks-Dt3XQ-3N.js +0 -1
- package/dist/chunks/localSearch-CeP4ef0a.js +0 -1
- package/dist/chunks/localSearch-Cz8Ot7k2.js +0 -1
- package/dist/chunks/lockfile-D5-j7HOZ.js +0 -1
- package/dist/chunks/main-CkjTzYj1.js +0 -513
- package/dist/chunks/managedEnv-K9Si1UuL.js +0 -1
- package/dist/chunks/mcp-DMBoeQzm.js +0 -6
- package/dist/chunks/mcp-TMOPfLcW.js +0 -1
- package/dist/chunks/mcp-x5rgv-uv.js +0 -2
- package/dist/chunks/memory-DDUoR63T.js +0 -1
- package/dist/chunks/model-BydaMaPr.js +0 -1
- package/dist/chunks/model-CDnVaVDR.js +0 -1
- package/dist/chunks/model-CIvbC7rW.js +0 -1
- package/dist/chunks/modelOptions-ut0xePEe.js +0 -1
- package/dist/chunks/nativeInstaller-fgCMR_c0.js +0 -1
- package/dist/chunks/parseConnectUrl-BiyKR5-x.js +0 -1
- package/dist/chunks/parser-B2PlJg4C.js +0 -1
- package/dist/chunks/permissions-BT3lxYBM.js +0 -3
- package/dist/chunks/pidLock-d1VPd6CG.js +0 -3
- package/dist/chunks/plan-M9DG3AqN.js +0 -1
- package/dist/chunks/plugin-BiNHuq3h.js +0 -17
- package/dist/chunks/pluginAutoupdate-B5lel6s5.js +0 -1
- package/dist/chunks/pluginBlocklist-CNGmIlwU.js +0 -1
- package/dist/chunks/pluginCliCommands-WLOEhb2M.js +0 -1
- package/dist/chunks/pluginOperations-BFbty6WT.js +0 -2
- package/dist/chunks/pluginStartupCheck-Bcdxg484.js +0 -1
- package/dist/chunks/plugins-BMZ3aYKP.js +0 -4
- package/dist/chunks/poorMode-Djw0P9Gu.js +0 -1
- package/dist/chunks/print-DmoLcwVq.js +0 -26
- package/dist/chunks/processBashCommand-B-VqME9O.js +0 -1
- package/dist/chunks/processSlashCommand-D6zEooTy.js +0 -5
- package/dist/chunks/prompt-C3RRe4kW.js +0 -1
- package/dist/chunks/prompt-EtAanewG.js +0 -1
- package/dist/chunks/protocolHandler-B83fCYI4.js +0 -13
- package/dist/chunks/reconciler-BGav_ezX.js +0 -1
- package/dist/chunks/refresh-DumNiLvM.js +0 -1
- package/dist/chunks/registerProtocol-DduKPsn_.js +0 -36
- package/dist/chunks/rename-BPknfVGF.js +0 -1
- package/dist/chunks/resume-DGz04xDh.js +0 -2
- package/dist/chunks/ripgrep-BLQnqPnE.js +0 -1
- package/dist/chunks/sandbox-adapter-DUqeqkQD.js +0 -1
- package/dist/chunks/sandbox-toggle-D61gVqcT.js +0 -1
- package/dist/chunks/searchExtraTools-CgsV6kb1.js +0 -1
- package/dist/chunks/server-LdbAb0sV.js +0 -1
- package/dist/chunks/serverBanner-BdExKFHT.js +0 -1
- package/dist/chunks/serverLog-BFmvyJ93.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-BJlrZaRD.js +0 -1
- package/dist/chunks/sessionManager-CPa049BO.js +0 -1
- package/dist/chunks/sessionObserver-BGYoLRGx.js +0 -1
- package/dist/chunks/sessionState-DSWN4tMV.js +0 -11
- package/dist/chunks/sessionStorage-zJ1esSCE.js +0 -1
- package/dist/chunks/sessionStoragePortable-BhkGMZWp.js +0 -3
- package/dist/chunks/settings-3ionQKNv.js +0 -1
- package/dist/chunks/settingsSync-dBqlrbcU.js +0 -1
- package/dist/chunks/setup-zf3v3ICe.js +0 -3
- package/dist/chunks/sinks-DppGvgz1.js +0 -1
- package/dist/chunks/sinks-mFsijQ_S.js +0 -2
- package/dist/chunks/skillChangeDetector-D-iq09Xs.js +0 -1
- package/dist/chunks/skills-BD-2ofXA.js +0 -1
- package/dist/chunks/src-P_wYS_NJ2.js +0 -53
- package/dist/chunks/startupProfiler-CUlV07MD.js +0 -1
- package/dist/chunks/status-CrmnCDIE.js +0 -1
- package/dist/chunks/statusNoticeHelpers-DakAVtQO.js +0 -1
- package/dist/chunks/switcher-Dm646gO5.js +0 -1
- package/dist/chunks/tasks-NpI1iEem.js +0 -1
- package/dist/chunks/teleport-Bs3kEipi.js +0 -1
- package/dist/chunks/theme-CEi3b_8f.js +0 -1
- package/dist/chunks/toolPool-DIT_uhtD.js +0 -1
- package/dist/chunks/trustedDevice-BokywSKL.js +0 -1
- package/dist/chunks/updateCCB-CzBxsuJe.js +0 -11
- package/dist/chunks/upstreamproxy-BuBFDFAD.js +0 -11
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-BHQfwlAl.js +0 -1
- package/dist/chunks/useMainLoopModel-BkyIIW9t.js +0 -1
- package/dist/chunks/useManagePlugins-BWROoGDs.js +0 -1
- package/dist/chunks/useMergedTools-CHxnwR7R.js +0 -1
- package/dist/chunks/useSettingsErrors-CPVQbsqq.js +0 -1
- package/dist/chunks/util-BfqXOA-P.js +0 -1
- package/dist/chunks/windowsPaths-B8p9tFRF.js +0 -1
- package/dist/chunks/workerRegistry-Cfo7bKlm.js +0 -6
- package/dist/chunks/worktree-D0k_pCEz.js +0 -1
- package/dist/chunks/xdg-DcF9ejUM.js +0 -1
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$c as n,AC as r,Cr as i,Dr as a,Ei as o,Hu as s,IC as c,Ir as l,Mp as u,Nu as d,Qu as f,Ti as ee,Tr as te,Vu as ne,Zu as re,cd as ie,hr as p,jp as m,ju as ae,lT as h,li as oe,sd as se,sr as ce,tl as g,uT as le}from"./loadAgentsDir-BXtV2jiO.js";import{C as ue,D as _,Gr as v,H as de,I as y,P as b,T as x,Wt as fe,Xn as pe,ai as me,di as S,fi as C,hn as he,k as ge,ot as _e,p as ve,t as w,ui as ye}from"./src-P_wYS_NJ2.js";import{t as T}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as be,et as xe,pt as Se}from"./state-BPFYBqm1.js";import{S as E,c as D,i as Ce,x as we}from"./debug-Dr1SjdXn.js";import{Ln as O,Rn as Te}from"./settings-DiBMs2gM.js";import{i as Ee,m as De}from"./git-CoQQ6YEf.js";import{a as k,o as Oe,s as ke}from"./log-27kCA_9u.js";import{n as Ae,r as A}from"./analytics-DJobLaWP.js";import{C as j,d as je,m as Me,v as Ne}from"./startupProfiler-Dc5r6LgE.js";import{_ as M,h as N}from"./model-CDnVaVDR.js";import{i as Pe,r as Fe}from"./shellQuote-C_I6DHLV.js";import{n as Ie,t as Le}from"./useExitOnCtrlCDWithKeybindings-BHQfwlAl.js";import{t as Re}from"./SearchBox-C9vUA4IM.js";import{n as ze,t as Be}from"./useSearchInput-q2CFPU4W.js";import{n as P,t as F}from"./Messages-CPX-nIdA.js";function Ve({log:e,onExit:t,onSelect:r}){let[i,o]=I.useState(null);I.useEffect(()=>{o(null),a(e)&&l(e).then(o)},[e]);let s=a(e)&&i===null,c=i??e,u=p(c)||``,d=n();return fe(`confirm:no`,t,{context:`Confirmation`}),fe(`confirm:yes`,(0,I.useCallback)(()=>{r(i??e)},[r,i,e]),{context:`Confirmation`}),s?(0,L.jsxs)(y,{flexDirection:`column`,padding:1,children:[(0,L.jsx)(ve,{message:`Loading session…`}),(0,L.jsx)(b,{dimColor:!0,children:(0,L.jsx)(x,{children:(0,L.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,L.jsxs)(y,{flexDirection:`column`,children:[(0,L.jsx)(F,{messages:c.messages,tools:d,commands:[],verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:u,screen:`transcript`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1}),(0,L.jsxs)(y,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,L.jsxs)(b,{children:[Me(c.modified),` · `,c.messageCount,` messages`,c.gitBranch?` · ${c.gitBranch}`:``]}),(0,L.jsx)(b,{dimColor:!0,children:(0,L.jsxs)(x,{children:[(0,L.jsx)(_,{shortcut:`Enter`,action:`resume`}),(0,L.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var I,L,He=e((()=>{I=t(C(),1),w(),r(),g(),Ne(),i(),u(),P(),L=T()}));function R(e,t){if(e===B)return 5;let n=v(e),r=t?Math.min(n,t-V-H):n;return Math.max(0,r)+V+H}function Ue(e,t){let n=t-V-H;return v(e)<=n?e:n<=1?e.charAt(0):j(e,n)}function We({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,o=Math.max(Ye,W),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=>R(e,l)),d=0,f=e.length;if(u.reduce((e,t,n)=>e+t+ +(n<u.length-1),0)>s){let t=s-Je,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 ee=d,te=e.length-f,ne=e.slice(d,f),re=ne.map((e,t)=>d+t);return(0,z.jsxs)(y,{flexDirection:`row`,gap:1,children:[(0,z.jsx)(b,{color:`suggestion`,children:i}),ee>0&&(0,z.jsxs)(b,{dimColor:!0,children:[U,ee]}),ne.map((e,t)=>{let n=re[t]===c,r=e===B?e:`#${Ue(e,l-V)}`;return(0,z.jsxs)(b,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),te>0?(0,z.jsxs)(b,{dimColor:!0,children:[Ge,te,Ke]}):(0,z.jsx)(b,{dimColor:!0,children:qe})]})}var z,B,V,H,U,Ge,Ke,qe,Je,Ye,W,G=e((()=>{C(),w(),Ne(),z=T(),B=`All`,V=2,H=1,U=`← `,Ge=`→`,Ke=` (tab to cycle)`,qe=`(tab to cycle)`,Je=5,Ye=18,W=14}));function Xe({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:ee,onUpFromFirstItem:te}){let[ne,ie]=K.useState(new Set),p=K.useRef(!1),m=K.useRef(null),ae=K.useCallback(e=>l?l(e):ne.has(e),[l,ne]),h=K.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=ae(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,ae]),oe=K.useCallback(e=>e?`▼ `:`▶ `,[]),se=K.useCallback(e=>` ▸ `,[]),ce=f??oe,g=ee??se,le=K.useCallback(e=>{let t=``;return e.hasChildren?t=ce(e.isExpanded):e.depth>0&&(t=g(e.depth)),t+e.node.label},[ce,g]),ue=K.useMemo(()=>h.map(e=>({label:le(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[h,le]),_=K.useMemo(()=>{let e=new Map;return h.forEach(t=>e.set(t.node.id,t.node)),e},[h]),v=K.useCallback(e=>h.find(t=>t.node.id===e),[h]),de=K.useCallback((e,t)=>{let n=v(e);!n||!n.hasChildren||(t?u?u(e):ie(t=>new Set(t).add(e)):d?d(e):ie(t=>{let n=new Set(t);return n.delete(e),n}))},[v,u,d]);return(0,Ze.jsx)(y,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||s)return;let t=v(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),de(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),de(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),p.current=!0,de(t.parentId,!1),r)){let e=_.get(t.parentId);e&&r(e)}}}},children:(0,Ze.jsx)(re,{options:ue,onChange:K.useCallback(e=>{let n=_.get(e);n&&t(n)},[_,t]),onFocus:K.useCallback(e=>{if(p.current){p.current=!1;return}if(m.current!==e&&(m.current=e,r)){let t=_.get(e);t&&r(t)}},[r,_]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:o,isDisabled:s,hideIndexes:c,onUpFromFirstItem:te})})}var K,Ze,Qe=e((()=>{K=t(C(),1),w(),f(),Ze=T()}));function $e(e,t){return j(e.replace(/\s+/g,` `).trim(),t)}function et({before:e,match:t,after:n},r){return ye.dim(e)+r(t)+ye.dim(n)}function tt(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 nt(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?lt:i?ut:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${$e(k(e),l)}${c}${s}`}function rt(e,t){let{isChild:n=!1,showProjectPath:r=!1}=t||{},i=n?` `:``,a=je(e),o=r&&e.projectPath?` · ${e.projectPath}`:``;return i+a+o}function it({logs:e,maxHeight:t=1/0,forceWidth:n,onCancel:r,onSelect:i,onLogsChanged:a,onLoadMore:o,initialSearchQuery:s,showAllProjects:c=!1,onToggleAllProjects:l,onAgenticSearch:u}){let d=_e(),f=n===void 0?d.columns:n,ie=Ie(r),h=pe(),g=te(),[le]=de(),v=ne(le),S=q.useMemo(()=>e=>me(e,v.warning),[v.warning]),[C,ve]=q.useState(null),[w,ye]=q.useState(!1),[T,be]=q.useState(!1),[E,D]=q.useState(!1),Ce=q.useMemo(()=>xe(),[]),[we,O]=q.useState(``),[Te,De]=q.useState(0),[Oe,ke]=q.useState(new Set),[Ae,j]=q.useState(null),[Me,Ne]=q.useState(1),[M,N]=q.useState(`list`),[Pe,Fe]=q.useState(null),Le=q.useRef(null),[Re,Be]=q.useState(0),[P,F]=q.useState({status:`idle`}),[I,L]=q.useState(!1),He=q.useRef(null),{query:R,setQuery:Ue,cursorOffset:z}=ze({isActive:M===`search`&&P.status!==`searching`,onExit:()=>{N(`list`),A(`tengu_session_search_toggled`,{enabled:!1})},onExitUp:()=>{N(`list`),A(`tengu_session_search_toggled`,{enabled:!1})},passthroughCtrlKeys:[`n`],initialQuery:s||``}),B=q.useDeferredValue(R),[V,H]=q.useState(``);q.useEffect(()=>{if(!B){H(``);return}let e=setTimeout(H,300,B);return()=>clearTimeout(e)},[B]);let[U,Ge]=q.useState(null),[Ke,qe]=q.useState(!1);q.useEffect(()=>{Ee().then(e=>ve(e)),ee(Ce).then(e=>{D(e.length>1)})},[Ce]);let Je=q.useMemo(()=>new Map(e.map(e=>[e,ot(e)])),[e]),Ye=q.useMemo(()=>null,[e,Je,!1]),W=q.useMemo(()=>ct(e),[e]),G=W.length>0,K=q.useMemo(()=>G?[`All`,...W]:[],[G,W]),Ze=K.length>0&&Re<K.length?Re:0,Qe=K[Ze],it=Qe===`All`?void 0:Qe,at=+!!G,lt=q.useMemo(()=>{let t=e;return g&&(t=e.filter(e=>{let t=Se(),n=p(e);return!!(t&&n===t||e.customTitle||ce(e.messages)||e.firstPrompt||e.customTitle)})),it!==void 0&&(t=t.filter(e=>e.tag===it)),w&&C&&(t=t.filter(e=>e.gitBranch===C)),E&&!T&&(t=t.filter(e=>e.projectPath===Ce)),t},[e,g,it,w,C,E,T,Ce]),ut=q.useMemo(()=>{if(!R)return lt;let e=R.toLowerCase();return lt.filter(t=>{let n=k(t).toLowerCase(),r=(t.gitBranch||``).toLowerCase(),i=(t.tag||``).toLowerCase(),a=t.prNumber?`pr #${t.prNumber} ${t.prRepository||``}`.toLowerCase():``;return n.includes(e)||r.includes(e)||i.includes(e)||a.includes(e)})},[lt,R]);q.useEffect(()=>{},[B,V,!1]),q.useEffect(()=>{Ge(null),qe(!1)},[V,Ye,!1]);let{filteredLogs:Y,snippets:X}=q.useMemo(()=>{let e=new Map,t=ut;if(U&&V&&U.query===V){for(let t of U.results)if(t.searchableText){let n=tt(t.searchableText,V,dt);n&&e.set(t.log,n)}let n=new Set(t.map(e=>e.messages[0]?.uuid)),r=U.results.map(e=>e.log).filter(e=>!n.has(e.messages[0]?.uuid));t=[...t,...r]}return{filteredLogs:t,snippets:e}},[ut,U,V]),Z=q.useMemo(()=>P.status===`results`&&P.results.length>0?P.results:Y,[P,Y]),Q=Math.max(30,f-4),ft=q.useMemo(()=>{if(!g)return[];let e=st(Z);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=Z.indexOf(n),i=X.get(n),a=i?et(i,S):null;if(t.length===1){let t=rt(n,{showProjectPath:c});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:nt(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?et(i,S):null,o=rt(t,{isChild:!0,showProjectPath:c});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:nt(t,Q,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),l=rt(n,{showProjectPath:c});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:nt(n,Q,{isGroupHeader:!0,forkCount:o}),description:a?`${l}\n ${a}`:l,dimDescription:!0,children:s}})},[g,Z,Q,c,X,S]),pt=q.useMemo(()=>g?[]:Z.map((e,t)=>{let n=$e(k(e)+(e.isSidechain?` (sidechain)`:``),Q),r=je(e),i=c&&e.projectPath?` · ${e.projectPath}`:``,a=X.get(e),o=a?et(a,S):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[g,Z,S,Q,c,X]),$=Ae?.value.log??null,mt=()=>{if(!g||!$)return``;let e=p($);if(!e)return``;let t=Z.filter(t=>p(t)===e);if(!(t.length>1))return``;let n=Oe.has(e);return t.indexOf($)>0||n?`← to collapse`:`→ to expand`},ht=q.useCallback(async()=>{let e=$?p($):void 0;if(!$||!e){N(`list`),O(``);return}we.trim()&&(await oe(e,we.trim(),$.fullPath),g&&a&&a()),N(`list`),O(``)},[$,we,a,g]),gt=q.useCallback(()=>{N(`list`),A(`tengu_session_search_toggled`,{enabled:!1})},[]),_t=q.useCallback(()=>{N(`search`),A(`tengu_session_search_toggled`,{enabled:!0})},[]),vt=q.useCallback(async()=>{if(!R.trim()||!u||!0)return;He.current?.abort();let t=new AbortController;He.current=t,F({status:`searching`}),A(`tengu_agentic_search_started`,{query_length:R.length});try{let n=await u(R,e,t.signal);if(t.signal.aborted)return;F({status:`results`,results:n,query:R}),A(`tengu_agentic_search_completed`,{query_length:R.length,results_count:n.length})}catch(e){if(t.signal.aborted)return;F({status:`error`,message:e instanceof Error?e.message:`Search failed`}),A(`tengu_agentic_search_error`,{query_length:R.length})}},[R,u,!1,e]);q.useEffect(()=>{P.status!==`idle`&&P.status!==`searching`&&(P.status===`results`&&P.query!==R||P.status===`error`)&&F({status:`idle`})},[R,P]),q.useEffect(()=>()=>{He.current?.abort()},[]);let yt=q.useRef(P.status);q.useEffect(()=>{let e=yt.current;if(yt.current=P.status,e===`searching`&&P.status===`results`){if(g&&ft.length>0)j(ft[0]);else if(!g&&Z.length>0){let e=Z[0];j({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[P.status,g,ft,Z]);let bt=q.useCallback(e=>{let t=parseInt(e,10),n=Z[t];!n||Le.current===t.toString()||(Le.current=t.toString(),j({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),Ne(t+1))},[Z]),xt=q.useCallback(e=>{j(e);let t=Z.findIndex(t=>p(t)===p(e.value.log));t>=0&&Ne(t+1)},[Z]);fe(`confirm:no`,()=>{He.current?.abort(),F({status:`idle`}),A(`tengu_agentic_search_cancelled`,{})},{context:`Confirmation`,isActive:M!==`preview`&&P.status===`searching`}),fe(`confirm:no`,()=>{N(`list`),O(``)},{context:`Settings`,isActive:M===`rename`&&P.status!==`searching`}),fe(`confirm:no`,()=>{Ue(``),L(!1),r?.()},{context:`Confirmation`,isActive:M!==`preview`&&M!==`rename`&&M!==`search`&&I&&P.status!==`searching`}),he((e,t)=>{if(M!==`preview`&&P.status!==`searching`&&M!==`rename`)if(M===`search`)e.toLowerCase()===`n`&&t.ctrl?gt():(t.return||t.downArrow)&&R.trim();else{if(I){if(t.return){vt(),L(!1);return}else if(t.downArrow){L(!1);return}else if(t.upArrow){N(`search`),L(!1);return}}if(G&&t.tab){let e=t.shift?-1:1;Be(t=>{let n=((t<K.length?t:0)+K.length+e)%K.length,r=K[n];return A(`tengu_session_tag_filter_changed`,{is_all:r===`All`,tag_count:W.length}),n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();if(r===`a`&&t.ctrl&&l)l(),A(`tengu_session_all_projects_toggled`,{enabled:!c});else if(r===`b`&&t.ctrl){let e=!w;ye(e),A(`tengu_session_branch_filter_toggled`,{enabled:e})}else if(r===`w`&&t.ctrl&&E){let e=!T;be(e),A(`tengu_session_worktree_filter_toggled`,{enabled:e})}else r===`/`&&n?(N(`search`),A(`tengu_session_search_toggled`,{enabled:!0})):r===`r`&&t.ctrl&&$?(N(`rename`),O(``),A(`tengu_session_rename_started`,{})):r===`v`&&t.ctrl&&$?(Fe($),N(`preview`),A(`tengu_session_preview_opened`,{messageCount:$.messageCount})):$&&n&&e.length>0&&!/^\s+$/.test(e)&&(N(`search`),Ue(e),A(`tengu_session_search_toggled`,{enabled:!0}))}},{isActive:!0});let St=[];w&&C&&St.push(C),E&&!T&&St.push(`current worktree`);let Ct=8+ +(St.length>0&&M!==`search`)+at,wt=Math.max(1,Math.floor((t-Ct-2)/3));return q.useEffect(()=>{if(!o)return;let e=wt*2;Me+e>=Z.length&&o(wt*3)},[Me,wt,Z.length,o]),e.length===0?null:M===`preview`&&Pe&&g?(0,J.jsx)(Ve,{log:Pe,onExit:()=>{N(`list`),Fe(null)},onSelect:i}):(0,J.jsxs)(y,{flexDirection:`column`,height:t-1,children:[(0,J.jsx)(y,{flexShrink:0,children:(0,J.jsx)(ue,{color:`suggestion`})}),(0,J.jsx)(y,{flexShrink:0,children:(0,J.jsx)(b,{children:` `})}),G?(0,J.jsx)(We,{tabs:K,selectedIndex:Ze,availableWidth:f,showAllProjects:c}):(0,J.jsx)(y,{flexShrink:0,children:(0,J.jsxs)(b,{bold:!0,color:`suggestion`,children:[`Resume Session`,M===`list`&&Z.length>wt&&(0,J.jsxs)(b,{dimColor:!0,children:[` `,`(`,Me,` of `,Z.length,`)`]})]})}),(0,J.jsx)(ge,{query:R,isFocused:M===`search`,isTerminalFocused:h,cursorOffset:z}),St.length>0&&M!==`search`&&(0,J.jsx)(y,{flexShrink:0,paddingLeft:2,children:(0,J.jsx)(b,{dimColor:!0,children:(0,J.jsx)(x,{children:St})})}),(0,J.jsx)(y,{flexShrink:0,children:(0,J.jsx)(b,{children:` `})}),P.status===`searching`&&(0,J.jsxs)(y,{paddingLeft:1,flexShrink:0,children:[(0,J.jsx)(ae,{}),(0,J.jsx)(b,{children:` Searching…`})]}),P.status===`results`&&P.results.length>0&&(0,J.jsx)(y,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(b,{dimColor:!0,italic:!0,children:`Claude found these results:`})}),P.status===`results`&&P.results.length===0&&Y.length===0&&(0,J.jsx)(y,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(b,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),P.status===`error`&&Y.length===0&&(0,J.jsx)(y,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(b,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!R.trim()&&u&&!1,P.status===`searching`?null:M===`rename`&&$?(0,J.jsxs)(y,{paddingLeft:2,flexDirection:`column`,children:[(0,J.jsx)(b,{bold:!0,children:`Rename session:`}),(0,J.jsx)(y,{paddingTop:1,children:(0,J.jsx)(se,{value:we,onChange:O,onSubmit:ht,placeholder:k($,`Enter new session name`),columns:f,cursorOffset:Te,onChangeCursorOffset:De,showCursor:!0})})]}):g?(0,J.jsx)(Xe,{nodes:ft,onSelect:e=>{i(e.value.log)},onFocus:xt,onCancel:r,focusNodeId:Ae?.id,visibleOptionCount:wt,layout:`expanded`,isDisabled:M===`search`||I,hideIndexes:!1,isNodeExpanded:e=>{if(M===`search`||w)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?Oe.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&(ke(e=>new Set(e).add(t)),A(`tengu_session_group_expanded`,{}))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&ke(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:_t}):(0,J.jsx)(re,{options:pt,onChange:e=>{let t=Z[parseInt(e,10)];t&&i(t)},visibleOptionCount:wt,onCancel:r,onFocus:bt,defaultFocusValue:Ae?.id.toString(),layout:`expanded`,isDisabled:M===`search`||I,onUpFromFirstItem:_t}),(0,J.jsx)(y,{paddingLeft:2,children:ie.pending?(0,J.jsxs)(b,{dimColor:!0,children:[`Press `,ie.keyName,` again to exit`]}):M===`rename`?(0,J.jsx)(b,{dimColor:!0,children:(0,J.jsxs)(x,{children:[(0,J.jsx)(_,{shortcut:`Enter`,action:`save`}),(0,J.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):P.status===`searching`?(0,J.jsx)(b,{dimColor:!0,children:(0,J.jsxs)(x,{children:[(0,J.jsx)(b,{children:`Searching with Claude…`}),(0,J.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):I?(0,J.jsx)(b,{dimColor:!0,children:(0,J.jsxs)(x,{children:[(0,J.jsx)(_,{shortcut:`Enter`,action:`search`}),(0,J.jsx)(_,{shortcut:`↓`,action:`skip`}),(0,J.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):M===`search`?(0,J.jsx)(b,{dimColor:!0,children:(0,J.jsxs)(x,{children:[(0,J.jsx)(b,{children:`Type to Search`}),(0,J.jsx)(_,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,J.jsx)(b,{dimColor:!0,children:(0,J.jsxs)(x,{children:[l&&(0,J.jsx)(_,{shortcut:`Ctrl+A`,action:`show ${c?`current dir`:`all projects`}`}),C&&(0,J.jsx)(_,{shortcut:`Ctrl+B`,action:`toggle branch`}),E&&(0,J.jsx)(_,{shortcut:`Ctrl+W`,action:`show ${T?`current worktree`:`all worktrees`}`}),(0,J.jsx)(_,{shortcut:`Ctrl+V`,action:`preview`}),(0,J.jsx)(_,{shortcut:`Ctrl+R`,action:`rename`}),(0,J.jsx)(b,{children:`Type to search`}),(0,J.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),mt()&&(0,J.jsx)(b,{children:mt()})]})})})]})}function at(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 ot(e){let t=(e.messages.length<=Y?e.messages:[...e.messages.slice(0,X),...e.messages.slice(-1e3)]).map(at).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 st(e){let t=new Map;for(let n of e){let e=p(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 ct(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 q,J,lt,ut,Y,X,Z,dt,Q=e((()=>{S(),q=t(C(),1),be(),Le(),Be(),c(),w(),r(),Ae(),Ne(),o(),De(),Oe(),i(),s(),u(),f(),Re(),He(),d(),G(),ie(),Qe(),J=T(),lt=2,ut=4,Y=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!!(k(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,n){if(!e.trim()||t.length===0)return[];let r=e.toLowerCase(),i=t.filter(e=>$(e,r)),o;if(i.length>=_t)o=i.slice(0,_t);else{let e=t.filter(e=>!$(e,r)),n=_t-i.length;o=[...i,...e.slice(0,n)]}D(`Agentic search: ${o.length}/${t.length} logs, query="${e}", matching: ${i.length}, with messages: ${O(o,e=>e.messages?.length>0)}`);let s=o.map(async e=>{if(a(e))try{return await l(e)}catch(t){return ke(t),e}return e}),c=await Promise.all(s);D(`Agentic search: loaded ${O(c,e=>e.messages?.length>0)}/${o.length} logs with transcripts`);let u=`Sessions:
|
|
2
|
-
${c.map((e,t)=>{let n=[`${t}:`],r=k(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.`;D(`Agentic search prompt (first 500 chars): ${u.slice(0,500)}...`);try{let e=N();D(`Agentic search using model: ${e}`);let t=(await le({model:e,system:vt,messages:[{role:`user`,content:u}],signal:n,querySource:`session_search`})).content.find(e=>e.type===`text`);if(!t||t.type!==`text`)return D(`No text content in agentic search response`),[];D(`Agentic search response: ${t.text}`);let r=t.text.match(/\{[\s\S]*\}/);if(!r)return D(`Could not find JSON in agentic search response`),[];let i=(E(r[0]).relevant_indices||[]).filter(e=>e>=0&&e<c.length).map(e=>c[e]);return D(`Agentic search found ${i.length} relevant sessions`),i}catch(e){return ke(e),D(`Agentic search error: ${e}`),[]}}var ht,gt,_t,vt,yt=e((()=>{Te(),Ce(),Oe(),M(),i(),h(),we(),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=xe();if(!t||!e.projectPath||e.projectPath===n)return{isCrossProject:!1};let r=p(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${Pe([e.projectPath])} && claude --resume ${r}`,projectPath:e.projectPath}}var xt=e((()=>{be(),Fe(),i()}));export{it as a,yt as i,xt as n,Q as o,mt as r,bt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=class{};export{e as DangerousBackend};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{C as t,P as n,R as r,c as i,i as a,x as o}from"./debug-Dr1SjdXn.js";import{n as s,r as c}from"./analytics-DJobLaWP.js";function l(e){return e.replace(_,(e,t,n)=>n.length<v?`"${t}":"[REDACTED]"`:`"${t}":"${`${n.slice(0,8)}...${n.slice(-4)}`}"`)}function u(e){let t=e.replace(/\n/g,`\\n`);return t.length<=g?t:t.slice(0,g)+`... (${t.length} chars)`}function d(e){let n=l(typeof e==`string`?e:t(e));return n.length<=g?n:n.slice(0,g)+`... (${n.length} chars)`}function f(e){let t=n(e);if(e&&typeof e==`object`&&`response`in e){let n=e.response;if(n?.data&&typeof n.data==`object`){let e=n.data,r=typeof e.message==`string`?e.message:typeof e.error==`object`&&e.error&&`message`in e.error&&typeof e.error.message==`string`?e.error.message:void 0;if(r)return`${t}: ${r}`}}return t}function p(e){if(e&&typeof e==`object`&&`response`in e&&e.response&&typeof e.response.status==`number`)return e.response.status}function m(e){if(!(!e||typeof e!=`object`)){if(`message`in e&&typeof e.message==`string`)return e.message;if(`error`in e&&e.error!==null&&typeof e.error==`object`&&`message`in e.error&&typeof e.error.message==`string`)return e.error.message}}function h(e,t,n){t&&i(t),c(`tengu_bridge_repl_skipped`,{reason:e,...n!==void 0&&{v2:n}})}var g,_,v,y=e((()=>{s(),a(),r(),o(),g=2e3,_=RegExp(`"(${[`session_ingress_token`,`environment_secret`,`access_token`,`secret`,`token`].join(`|`)})"\\s*:\\s*"([^"]*)"`,`g`),v=16}));export{p as a,m as i,u as n,y as o,f as r,h as s,d as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t,o as n}from"./detectRepository-CMEkS5_2.js";t();export{e as parseGitHubRepository,n as parseGitRemote};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-Besi3Os3.js";import{f as r,u as i}from"./debug-Dr1SjdXn.js";import{cr as a,or as o}from"./settings-DiBMs2gM.js";import{o as s,s as c}from"./log-27kCA_9u.js";import{a as l,i as u}from"./memoize-Co4vS6UF.js";import{basename as d,dirname as f,join as p,sep as m}from"path";function h(e,t){if(!e)return{directory:t||n(),prefix:``};let r=o(e,t);return e.endsWith(`/`)||e.endsWith(m)?{directory:r,prefix:``}:{directory:f(r),prefix:d(e)}}async function g(e){let t=C.get(e);if(t)return t;try{let t=(await i().readdir(e)).filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:`directory`})).slice(0,100);return C.set(e,t),t}catch(e){return c(e),[]}}async function _(e,t={}){let{basePath:r=n(),maxResults:i=10}=t,{directory:a,prefix:o}=h(e,r),s=await g(a),c=o.toLowerCase();return s.filter(e=>e.name.toLowerCase().startsWith(c)).slice(0,i).map(e=>({id:e.path,displayText:e.name+`/`,description:`directory`,metadata:{type:`directory`}}))}function v(e){return e.startsWith(`~/`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`)||e===`~`||e===`.`||e===`..`}async function y(e,t=!1){let n=`${e}:${t}`,r=w.get(n);if(r)return r;try{let r=(await i().readdir(e)).filter(e=>t||!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:t.isDirectory()?`directory`:`file`})).sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name)).slice(0,100);return w.set(n,r),r}catch(e){return c(e),[]}}async function b(e,t={}){let{basePath:r=n(),maxResults:i=10,includeFiles:a=!0,includeHidden:o=!1}=t,{directory:s,prefix:c}=h(e,r),l=await y(s,o),u=c.toLowerCase(),d=l.filter(e=>!a&&e.type===`file`?!1:e.name.toLowerCase().startsWith(u)).slice(0,i),f=e.includes(`/`)||e.includes(m),p=``;if(f){let t=e.lastIndexOf(`/`),n=e.lastIndexOf(m),r=Math.max(t,n);p=e.substring(0,r+1)}return(p.startsWith(`./`)||p.startsWith(`.`+m))&&(p=p.slice(2)),d.map(e=>{let t=p+e.name;return{id:t,displayText:e.type===`directory`?t+`/`:t,metadata:{type:e.type}}})}var x,S,C,w,T=e((()=>{l(),t(),r(),s(),a(),x=500,S=300*1e3,C=new u({max:x,ttl:S}),w=new u({max:x,ttl:S})}));export{v as i,b as n,T as r,_ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Doctor-CZ513Df9.js";var i,a;e((()=>{n(),i=t(),a=(e,t,n)=>Promise.resolve((0,i.jsx)(r,{onDone:e}))}))();export{a as call};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{Bi as n,Cr as r,Cu as i,Fi as a,Su as o,U as s,W as c,bf as l,cr as u,ec as d,el as f,i as p,mb as m,o as h,tc as g,tl as _,ub as ee,yf as te}from"./loadAgentsDir-BXtV2jiO.js";import{A as v,C as y,M as b,O as x,P as S,b as C,j as w,l as ne,m as T,p as E,v as D,w as O}from"./external-CEp-aPkt.js";import{r as re}from"./lazySchema-B4D4qJVE.js";import{Bn as ie,Wt as k,_r as ae,et as oe,gr as se,ht as ce,or as A}from"./state-BPFYBqm1.js";import{f as le,g as ue}from"./settings-DiBMs2gM.js";import{h as de,r as fe}from"./config-9rLTDOYW.js";import{l as pe,p as me,r as he}from"./sessionStoragePortable-BhkGMZWp.js";import{_ as ge,u as _e}from"./model-CDnVaVDR.js";import{bn as ve,yn as ye}from"./prompt-CRc2QEZ5.js";import{n as be,r as xe}from"./managedEnv-B-BNY0xC.js";import{t as Se}from"./QueryEngine-HkswHUNv.js";import{n as Ce,t as we}from"./modelOptions-ut0xePEe.js";import{dirname as Te}from"node:path";import{randomUUID as j}from"node:crypto";import{Readable as Ee,Writable as De}from"node:stream";import{unlink as Oe}from"node:fs/promises";import*as M from"node:path/posix";import{isAbsolute as ke,resolve as Ae}from"node:path/posix";re();var N={authenticate:`authenticate`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_focus:`document/didFocus`,document_did_open:`document/didOpen`,document_did_save:`document/didSave`,initialize:`initialize`,logout:`logout`,nes_accept:`nes/accept`,nes_close:`nes/close`,nes_reject:`nes/reject`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,session_cancel:`session/cancel`,session_close:`session/close`,session_fork:`session/fork`,session_list:`session/list`,session_load:`session/load`,session_new:`session/new`,session_prompt:`session/prompt`,session_resume:`session/resume`,session_set_config_option:`session/set_config_option`,session_set_mode:`session/set_mode`,session_set_model:`session/set_model`},P={elicitation_complete:`elicitation/complete`,elicitation_create:`elicitation/create`,fs_read_text_file:`fs/read_text_file`,fs_write_text_file:`fs/write_text_file`,session_request_permission:`session/request_permission`,session_update:`session/update`,terminal_create:`terminal/create`,terminal_kill:`terminal/kill`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`},je=O({_meta:x(v(),b()).nullish(),terminal:T().optional().default(!1)}),Me=O({_meta:x(v(),b()).nullish(),label:v().nullish(),name:v(),optional:T().optional().default(!1),secret:T().optional().default(!0)}),Ne=O({_meta:x(v(),b()).nullish(),description:v().nullish(),id:v(),name:v()}),Pe=O({_meta:x(v(),b()).nullish(),description:v().nullish(),id:v(),link:v().nullish(),name:v(),vars:E(Me)}),Fe=O({_meta:x(v(),b()).nullish(),args:E(v()).optional(),description:v().nullish(),env:x(v(),v()).optional(),id:v(),name:v()}),Ie=w([Pe.and(O({type:C(`env_var`)})),Fe.and(O({type:C(`terminal`)})),Ne]),Le=O({_meta:x(v(),b()).nullish(),methodId:v()}),Re=O({_meta:x(v(),b()).nullish()}),ze=O({_meta:x(v(),b()).nullish(),blob:v(),mimeType:v().nullish(),uri:v()}),Be=O({default:T().nullish(),description:v().nullish(),title:v().nullish()}),Ve=O({_meta:x(v(),b()).nullish()}),He=O({_meta:x(v(),b()).nullish()}),Ue=O({amount:y(),currency:v()}),We=O({_meta:x(v(),b()).nullish(),terminalId:v()}),Ge=O({_meta:x(v(),b()).nullish(),newText:v(),oldText:v().nullish(),path:v()}),Ke=w([v(),y(),y(),T(),E(v())]),qe=D(w([O({content:x(v(),Ke).nullish()}).and(O({action:C(`accept`)})),O({action:C(`decline`)}),O({action:C(`cancel`)})]),O({_meta:x(v(),b()).nullish()})),Je=O({_meta:x(v(),b()).nullish()}),Ye=v(),Xe=O({_meta:x(v(),b()).nullish(),elicitationId:Ye}),Ze=C(`object`),Qe=C(`string`),$e=O({_meta:x(v(),b()).nullish()}),et=O({_meta:x(v(),b()).nullish(),form:Je.nullish(),url:$e.nullish()}),tt=O({const:v(),title:v()}),nt=O({_meta:x(v(),b()).nullish(),name:v(),value:v()}),rt=O({code:w([C(-32700),C(-32600),C(-32601),C(-32602),C(-32603),C(-32800),C(-32e3),C(-32002),C(-32042),y().int().min(-2147483648,{message:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{message:`Invalid value: Expected int32 to be <= 2147483647`})]),data:b().optional(),message:v()}),it=b(),at=b(),ot=b(),st=O({_meta:x(v(),b()).nullish(),readTextFile:T().optional().default(!1),writeTextFile:T().optional().default(!1)}),ct=O({_meta:x(v(),b()).nullish(),name:v(),value:v()}),lt=O({_meta:x(v(),b()).nullish(),name:v(),title:v().nullish(),version:v()}),ut=O({default:y().nullish(),description:v().nullish(),maximum:y().nullish(),minimum:y().nullish(),title:v().nullish()}),dt=O({_meta:x(v(),b()).nullish()}),ft=O({_meta:x(v(),b()).nullish(),additionalDirectories:E(v()).optional(),cursor:v().nullish(),cwd:v().nullish()}),pt=O({_meta:x(v(),b()).nullish()}),mt=O({_meta:x(v(),b()).nullish(),logout:pt.nullish()}),ht=O({_meta:x(v(),b()).nullish()}),gt=O({_meta:x(v(),b()).nullish()}),_t=O({_meta:x(v(),b()).nullish(),http:T().optional().default(!1),sse:T().optional().default(!1)}),vt=O({_meta:x(v(),b()).nullish(),headers:E(ct),name:v(),url:v()}),yt=O({_meta:x(v(),b()).nullish(),headers:E(ct),name:v(),url:v()}),bt=O({_meta:x(v(),b()).nullish(),args:E(v()),command:v(),env:E(nt),name:v()}),F=w([vt.and(O({type:C(`http`)})),yt.and(O({type:C(`sse`)})),bt]),xt=v(),St=O({_meta:x(v(),b()).nullish(),description:v().nullish(),modelId:xt,name:v()}),Ct=w([C(`error`),C(`warning`),C(`information`),C(`hint`)]),wt=O({_meta:x(v(),b()).nullish()}),Tt=O({_meta:x(v(),b()).nullish()}),Et=O({_meta:x(v(),b()).nullish()}),Dt=O({_meta:x(v(),b()).nullish()}),Ot=O({_meta:x(v(),b()).nullish()}),kt=O({_meta:x(v(),b()).nullish(),maxCount:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),At=O({diff:v(),uri:v()}),jt=O({endLine:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),startLine:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),text:v()}),Mt=O({_meta:x(v(),b()).nullish()}),Nt=O({_meta:x(v(),b()).nullish()}),Pt=O({languageId:v(),text:v(),uri:v()}),Ft=O({_meta:x(v(),b()).nullish(),maxCount:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),It=w([C(`rejected`),C(`ignored`),C(`replaced`),C(`cancelled`)]),Lt=O({excerpts:E(jt),uri:v()}),Rt=O({_meta:x(v(),b()).nullish()}),zt=O({_meta:x(v(),b()).nullish()}),Bt=O({name:v(),owner:v(),remoteUrl:v()}),Vt=O({_meta:x(v(),b()).nullish()}),Ht=O({_meta:x(v(),b()).nullish(),jump:Mt.nullish(),rename:zt.nullish(),searchAndReplace:Vt.nullish()}),Ut=O({id:v(),isRegex:T().nullish(),replace:v(),search:v(),uri:v()}),Wt=w([C(`automatic`),C(`diagnostic`),C(`manual`)]),Gt=O({_meta:x(v(),b()).nullish(),maxCount:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Kt=O({_meta:x(v(),b()).nullish(),diagnostics:wt.nullish(),editHistory:kt.nullish(),openFiles:Nt.nullish(),recentFiles:Ft.nullish(),relatedSnippets:Rt.nullish(),userActions:Gt.nullish()}),qt=O({_meta:x(v(),b()).nullish(),additionalDirectories:E(v()).optional(),cwd:v(),mcpServers:E(F)}),Jt=O({default:y().nullish(),description:v().nullish(),maximum:y().nullish(),minimum:y().nullish(),title:v().nullish()}),Yt=v(),Xt=w([C(`allow_once`),C(`allow_always`),C(`reject_once`),C(`reject_always`)]),Zt=O({_meta:x(v(),b()).nullish(),kind:Xt,name:v(),optionId:Yt}),Qt=w([C(`high`),C(`medium`),C(`low`)]),$t=w([C(`pending`),C(`in_progress`),C(`completed`)]),en=O({_meta:x(v(),b()).nullish(),content:v(),priority:Qt,status:$t}),tn=O({_meta:x(v(),b()).nullish(),entries:E(en)}),I=O({character:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),line:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`})}),nn=O({id:v(),position:I,uri:v()}),rn=O({id:v(),newName:v(),position:I,uri:v()}),an=O({action:v(),position:I,timestampMs:y(),uri:v()}),on=w([C(`utf-16`),C(`utf-32`),C(`utf-8`)]),sn=O({_meta:x(v(),b()).nullish(),auth:je.optional().default({terminal:!1}),elicitation:et.nullish(),fs:st.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Ht.nullish(),positionEncodings:E(on).optional(),terminal:T().optional().default(!1)}),cn=O({_meta:x(v(),b()).nullish(),audio:T().optional().default(!1),embeddedContext:T().optional().default(!1),image:T().optional().default(!1)}),ln=y().int().gte(0).lte(65535),un=O({_meta:x(v(),b()).nullish(),clientCapabilities:sn.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:lt.nullish(),protocolVersion:ln}),L=O({end:I,start:I}),dn=O({message:v(),range:L,severity:Ct,uri:v()}),fn=O({languageId:v(),lastFocusedMs:y().nullish(),uri:v(),visibleRange:L.nullish()}),pn=O({_meta:x(v(),b()).nullish(),diagnostics:E(dn).nullish(),editHistory:E(At).nullish(),openFiles:E(fn).nullish(),recentFiles:E(Pt).nullish(),relatedSnippets:E(Lt).nullish(),userActions:E(an).nullish()}),mn=O({newText:v(),range:L}),hn=w([O({cursorPosition:I.nullish(),edits:E(mn),id:v(),uri:v()}).and(O({kind:C(`edit`)})),nn.and(O({kind:C(`jump`)})),rn.and(O({kind:C(`rename`)})),Ut.and(O({kind:C(`searchAndReplace`)}))]),gn=O({_meta:x(v(),b()).nullish(),content:v()}),_n=O({_meta:x(v(),b()).nullish()}),R=w([y(),v()]).nullable();O({_meta:x(v(),b()).nullish(),requestId:R});var vn=O({requestId:R}),yn=ne([`assistant`,`user`]),z=O({_meta:x(v(),b()).nullish(),audience:E(yn).nullish(),lastModified:v().nullish(),priority:y().nullish()}),bn=O({_meta:x(v(),b()).nullish(),annotations:z.nullish(),data:v(),mimeType:v()}),xn=O({_meta:x(v(),b()).nullish(),annotations:z.nullish(),data:v(),mimeType:v(),uri:v().nullish()}),Sn=O({_meta:x(v(),b()).nullish(),annotations:z.nullish(),description:v().nullish(),mimeType:v().nullish(),name:v(),size:y().nullish(),title:v().nullish(),uri:v()}),Cn=O({_meta:x(v(),b()).nullish(),optionId:Yt}),wn=w([O({outcome:C(`cancelled`)}),Cn.and(O({outcome:C(`selected`)}))]),Tn=O({_meta:x(v(),b()).nullish(),outcome:wn}),En=O({_meta:x(v(),b()).nullish()}),Dn=O({_meta:x(v(),b()).nullish()}),On=O({currentValue:T()}),kn=v(),An=v(),jn=w([C(`mode`),C(`model`),C(`thought_level`),v()]),Mn=v(),Nn=O({_meta:x(v(),b()).nullish(),description:v().nullish(),name:v(),value:Mn}),Pn=O({_meta:x(v(),b()).nullish(),group:kn,name:v(),options:E(Nn)}),B=D(w([O({currentValue:Mn,options:w([E(Nn),E(Pn)])}).and(O({type:C(`select`)})),On.and(O({type:C(`boolean`)}))]),O({_meta:x(v(),b()).nullish(),category:jn.nullish(),description:v().nullish(),id:An,name:v()})),Fn=O({_meta:x(v(),b()).nullish(),configOptions:E(B)}),In=O({_meta:x(v(),b()).nullish()}),V=v(),Ln=O({_meta:x(v(),b()).nullish(),id:v(),sessionId:V}),Rn=O({_meta:x(v(),b()).nullish(),sessionId:V}),zn=O({_meta:x(v(),b()).nullish(),sessionId:V}),Bn=O({_meta:x(v(),b()).nullish(),sessionId:V}),Vn=O({_meta:x(v(),b()).nullish(),args:E(v()).optional(),command:v(),cwd:v().nullish(),env:E(nt).optional(),outputByteLimit:y().nullish(),sessionId:V}),Hn=O({_meta:x(v(),b()).nullish(),sessionId:V,uri:v()}),Un=O({_meta:x(v(),b()).nullish(),position:I,sessionId:V,uri:v(),version:y(),visibleRange:L}),Wn=O({_meta:x(v(),b()).nullish(),languageId:v(),sessionId:V,text:v(),uri:v(),version:y()}),Gn=O({_meta:x(v(),b()).nullish(),sessionId:V,uri:v()}),Kn=O({_meta:x(v(),b()).nullish(),additionalDirectories:E(v()).optional(),cwd:v(),mcpServers:E(F).optional(),sessionId:V}),qn=O({_meta:x(v(),b()).nullish(),sessionId:V,terminalId:v()}),Jn=O({_meta:x(v(),b()).nullish(),additionalDirectories:E(v()).optional(),cwd:v(),mcpServers:E(F),sessionId:V}),Yn=O({_meta:x(v(),b()).nullish(),limit:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),line:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:v(),sessionId:V}),Xn=O({_meta:x(v(),b()).nullish(),id:v(),reason:It.nullish(),sessionId:V}),Zn=O({_meta:x(v(),b()).nullish(),sessionId:V,terminalId:v()}),Qn=O({_meta:x(v(),b()).nullish(),additionalDirectories:E(v()).optional(),cwd:v(),mcpServers:E(F).optional(),sessionId:V}),$n=O({_meta:x(v(),b()).nullish(),additionalDirectories:E(v()).optional(),cwd:v(),sessionId:V,title:v().nullish(),updatedAt:v().nullish()}),er=O({_meta:x(v(),b()).nullish(),nextCursor:v().nullish(),sessions:E($n)}),tr=O({_meta:x(v(),b()).nullish(),title:v().nullish(),updatedAt:v().nullish()}),nr=O({_meta:x(v(),b()).nullish()}),H=v(),rr=O({_meta:x(v(),b()).nullish(),currentModeId:H}),ir=O({_meta:x(v(),b()).nullish(),description:v().nullish(),id:H,name:v()}),U=O({_meta:x(v(),b()).nullish(),availableModes:E(ir),currentModeId:H}),W=O({_meta:x(v(),b()).nullish(),availableModels:E(St),currentModelId:xt}),ar=O({_meta:x(v(),b()).nullish(),configOptions:E(B).nullish(),models:W.nullish(),modes:U.nullish(),sessionId:V}),or=O({_meta:x(v(),b()).nullish(),configOptions:E(B).nullish(),models:W.nullish(),modes:U.nullish()}),sr=O({_meta:x(v(),b()).nullish(),configOptions:E(B).nullish(),models:W.nullish(),modes:U.nullish(),sessionId:V}),cr=O({_meta:x(v(),b()).nullish(),configOptions:E(B).nullish(),models:W.nullish(),modes:U.nullish()}),lr=O({_meta:x(v(),b()).nullish()}),ur=O({_meta:x(v(),b()).nullish(),additionalDirectories:En.nullish(),close:Dn.nullish(),fork:In.nullish(),list:nr.nullish(),resume:lr.nullish()}),dr=D(w([O({type:C(`boolean`),value:T()}),O({value:Mn})]),O({_meta:x(v(),b()).nullish(),configId:An,sessionId:V})),fr=O({_meta:x(v(),b()).nullish(),configOptions:E(B)}),pr=O({_meta:x(v(),b()).nullish(),modeId:H,sessionId:V}),mr=O({_meta:x(v(),b()).nullish()}),hr=O({_meta:x(v(),b()).nullish(),modelId:xt,sessionId:V}),gr=O({_meta:x(v(),b()).nullish()}),_r=O({_meta:x(v(),b()).nullish(),sessionId:V}),vr=w([C(`end_turn`),C(`max_tokens`),C(`max_turn_requests`),C(`refusal`),C(`cancelled`)]),yr=w([C(`email`),C(`uri`),C(`date`),C(`date-time`)]),br=O({default:v().nullish(),description:v().nullish(),enum:E(v()).nullish(),format:yr.nullish(),maxLength:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),minLength:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),oneOf:E(tt).nullish(),pattern:v().nullish(),title:v().nullish()}),xr=O({_meta:x(v(),b()).nullish(),context:pn.nullish(),position:I,selection:L.nullish(),sessionId:V,triggerKind:Wt,uri:v(),version:y()}),Sr=O({_meta:x(v(),b()).nullish(),suggestions:E(hn)}),Cr=O({_meta:x(v(),b()).nullish(),terminalId:v()}),wr=O({_meta:x(v(),b()).nullish(),exitCode:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:v().nullish()}),Tr=O({_meta:x(v(),b()).nullish(),sessionId:V,terminalId:v()}),Er=O({_meta:x(v(),b()).nullish(),exitStatus:wr.nullish(),output:v(),truncated:T()}),Dr=O({_meta:x(v(),b()).nullish(),annotations:z.nullish(),text:v()}),Or=O({range:L.nullish(),text:v()}),kr=O({_meta:x(v(),b()).nullish(),contentChanges:E(Or),sessionId:V,uri:v(),version:y()});O({method:v(),params:w([Rn,Wn,kr,Hn,Gn,Un,Ln,Xn,it]).nullish()});var Ar=w([C(`full`),C(`incremental`)]),jr=O({_meta:x(v(),b()).nullish(),syncKind:Ar}),Mr=O({_meta:x(v(),b()).nullish(),didChange:jr.nullish(),didClose:Tt.nullish(),didFocus:Et.nullish(),didOpen:Dt.nullish(),didSave:Ot.nullish()}),Nr=O({_meta:x(v(),b()).nullish(),document:Mr.nullish()}),Pr=O({_meta:x(v(),b()).nullish(),context:Kt.nullish(),events:Nr.nullish()}),Fr=O({_meta:x(v(),b()).nullish(),auth:mt.optional().default({}),loadSession:T().optional().default(!1),mcpCapabilities:_t.optional().default({http:!1,sse:!1}),nes:Pr.nullish(),positionEncoding:on.nullish(),promptCapabilities:cn.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:ur.optional().default({})}),Ir=O({_meta:x(v(),b()).nullish(),agentCapabilities:Fr.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:lt.nullish(),authMethods:E(Ie).optional().default([]),protocolVersion:ln}),Lr=w([O({_meta:x(v(),b()).nullish(),mimeType:v().nullish(),text:v(),uri:v()}),ze]),Rr=O({_meta:x(v(),b()).nullish(),annotations:z.nullish(),resource:Lr}),zr=w([Dr.and(O({type:C(`text`)})),xn.and(O({type:C(`image`)})),bn.and(O({type:C(`audio`)})),Sn.and(O({type:C(`resource_link`)})),Rr.and(O({type:C(`resource`)}))]),Br=O({_meta:x(v(),b()).nullish(),content:zr}),G=O({_meta:x(v(),b()).nullish(),content:zr,messageId:v().nullish()}),Vr=O({_meta:x(v(),b()).nullish(),messageId:v().nullish(),prompt:E(zr),sessionId:V}),Hr=O({anyOf:E(tt)}),Ur=w([Br.and(O({type:C(`content`)})),Ge.and(O({type:C(`diff`)})),Cr.and(O({type:C(`terminal`)}))]),Wr=v(),Gr=O({sessionId:V,toolCallId:Wr.nullish()}),Kr=D(w([Gr,vn]),O({elicitationId:Ye,url:v().url()})),qr=O({_meta:x(v(),b()).nullish(),line:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:v()}),Jr=w([C(`pending`),C(`in_progress`),C(`completed`),C(`failed`)]),Yr=w([C(`read`),C(`edit`),C(`delete`),C(`move`),C(`search`),C(`execute`),C(`think`),C(`fetch`),C(`switch_mode`),C(`other`)]),Xr=O({_meta:x(v(),b()).nullish(),content:E(Ur).optional(),kind:Yr.optional(),locations:E(qr).optional(),rawInput:b().optional(),rawOutput:b().optional(),status:Jr.optional(),title:v(),toolCallId:Wr}),Zr=O({_meta:x(v(),b()).nullish(),content:E(Ur).nullish(),kind:Yr.nullish(),locations:E(qr).nullish(),rawInput:b().optional(),rawOutput:b().optional(),status:Jr.nullish(),title:v().nullish(),toolCallId:Wr}),Qr=O({_meta:x(v(),b()).nullish(),options:E(Zt),sessionId:V,toolCall:Zr}),$r=O({_meta:x(v(),b()).nullish(),hint:v()}),ei=O({_meta:x(v(),b()).nullish(),description:v(),input:$r.nullish(),name:v()}),ti=O({_meta:x(v(),b()).nullish(),availableCommands:E(ei)}),ni=w([O({enum:E(v()),type:Qe}),Hr]),ri=O({default:E(v()).nullish(),description:v().nullish(),items:ni,maxItems:y().nullish(),minItems:y().nullish(),title:v().nullish()}),ii=w([br.and(O({type:C(`string`)})),Jt.and(O({type:C(`number`)})),ut.and(O({type:C(`integer`)})),Be.and(O({type:C(`boolean`)})),ri.and(O({type:C(`array`)}))]),ai=O({description:v().nullish(),properties:x(v(),ii).optional().default({}),required:E(v()).nullish(),title:v().nullish(),type:Ze.optional().default(`object`)}),oi=D(w([D(w([Gr,vn]),O({requestedSchema:ai})).and(O({mode:C(`form`)})),Kr.and(O({mode:C(`url`)}))]),O({_meta:x(v(),b()).nullish(),message:v()})),si=O({cachedReadTokens:y().nullish(),cachedWriteTokens:y().nullish(),inputTokens:y(),outputTokens:y(),thoughtTokens:y().nullish(),totalTokens:y()});w([O({id:R,result:w([Ir,Re,gt,sr,or,er,ar,cr,He,mr,fr,O({_meta:x(v(),b()).nullish(),stopReason:vr,usage:si.nullish(),userMessageId:v().nullish()}),gr,_r,Sr,Ve,ot])}),O({error:rt,id:R})]);var ci=O({_meta:x(v(),b()).nullish(),cost:Ue.nullish(),size:y(),used:y()}),li=w([G.and(O({sessionUpdate:C(`user_message_chunk`)})),G.and(O({sessionUpdate:C(`agent_message_chunk`)})),G.and(O({sessionUpdate:C(`agent_thought_chunk`)})),Xr.and(O({sessionUpdate:C(`tool_call`)})),Zr.and(O({sessionUpdate:C(`tool_call_update`)})),tn.and(O({sessionUpdate:C(`plan`)})),ti.and(O({sessionUpdate:C(`available_commands_update`)})),rr.and(O({sessionUpdate:C(`current_mode_update`)})),Fn.and(O({sessionUpdate:C(`config_option_update`)})),tr.and(O({sessionUpdate:C(`session_info_update`)})),ci.and(O({sessionUpdate:C(`usage_update`)}))]),ui=O({_meta:x(v(),b()).nullish(),sessionId:V,update:li});O({method:v(),params:w([ui,Xe,it]).nullish()});var di=O({_meta:x(v(),b()).nullish(),sessionId:V,terminalId:v()}),fi=O({_meta:x(v(),b()).nullish(),exitCode:y().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:v().nullish()}),pi=O({name:v(),uri:v()}),mi=O({_meta:x(v(),b()).nullish(),repository:Bt.nullish(),workspaceFolders:E(pi).nullish(),workspaceUri:v().nullish()});O({id:R,method:v(),params:w([un,Le,ht,qt,Jn,ft,Kn,Qn,Bn,pr,dr,Vr,hr,mi,xr,zn,at]).nullish()});var hi=O({_meta:x(v(),b()).nullish(),content:v(),path:v(),sessionId:V});O({id:R,method:v(),params:w([hi,Yn,Qr,Vn,Tr,Zn,di,qn,oi,at]).nullish()}),w([O({id:R,result:w([O({_meta:x(v(),b()).nullish()}),gn,Tn,We,Er,_n,fi,dt,qe,ot])}),O({error:rt,id:R})]),e();function gi(e,t){let n=new TextEncoder,r=new TextDecoder;return{readable:new ReadableStream({async start(e){let n=``,i=t.getReader();try{for(;;){let{value:t,done:a}=await i.read();if(a){n+=r.decode();break}if(!t)continue;n+=r.decode(t,{stream:!0});let o=n.split(`
|
|
2
|
-
`);n=o.pop()||``;for(let t of o){let n=t.trim();if(n)try{let t=JSON.parse(n);e.enqueue(t)}catch(e){console.error(`Failed to parse JSON message:`,n,e)}}}let t=n.trim();if(t)try{let n=JSON.parse(t);e.enqueue(n)}catch(e){console.error(`Failed to parse JSON message:`,t,e)}}catch(t){e.error(t);return}finally{i.releaseLock()}e.close()}}),writable:new WritableStream({async write(t){let r=JSON.stringify(t)+`
|
|
3
|
-
`,i=e.getWriter();try{await i.write(n.encode(r))}finally{i.releaseLock()}}})}}re();var _i,vi=class{constructor(e,n){t(this,`connection`,void 0);let r=e(this),i=async(e,t)=>{switch(e){case N.initialize:{let e=un.parse(t);return r.initialize(e)}case N.session_new:{let e=qt.parse(t);return r.newSession(e)}case N.session_load:{if(!r.loadSession)throw K.methodNotFound(e);let n=Jn.parse(t);return r.loadSession(n)}case N.session_list:{if(!r.listSessions)throw K.methodNotFound(e);let n=ft.parse(t);return r.listSessions(n)}case N.session_fork:{if(!r.unstable_forkSession)throw K.methodNotFound(e);let n=Kn.parse(t);return r.unstable_forkSession(n)}case N.session_resume:{if(!r.unstable_resumeSession)throw K.methodNotFound(e);let n=Qn.parse(t);return r.unstable_resumeSession(n)}case N.session_close:{if(!r.unstable_closeSession)throw K.methodNotFound(e);let n=Bn.parse(t);return r.unstable_closeSession(n)}case N.session_set_mode:{if(!r.setSessionMode)throw K.methodNotFound(e);let n=pr.parse(t);return await r.setSessionMode(n)??{}}case N.authenticate:{let e=Le.parse(t);return await r.authenticate(e)??{}}case N.logout:{if(!r.unstable_logout)throw K.methodNotFound(e);let n=ht.parse(t);return await r.unstable_logout(n)??{}}case N.session_prompt:{let e=Vr.parse(t);return r.prompt(e)}case N.session_set_model:{if(!r.unstable_setSessionModel)throw K.methodNotFound(e);let n=hr.parse(t);return await r.unstable_setSessionModel(n)??{}}case N.session_set_config_option:{if(!r.setSessionConfigOption)throw K.methodNotFound(e);let n=dr.parse(t);return r.setSessionConfigOption(n)}case N.nes_start:{if(!r.unstable_startNes)throw K.methodNotFound(e);let n=mi.parse(t);return r.unstable_startNes(n)}case N.nes_suggest:{if(!r.unstable_suggestNes)throw K.methodNotFound(e);let n=xr.parse(t);return r.unstable_suggestNes(n)}case N.nes_close:{if(!r.unstable_closeNes)throw K.methodNotFound(e);let n=zn.parse(t);return await r.unstable_closeNes(n)??{}}default:if(r.extMethod)return r.extMethod(e,t);throw K.methodNotFound(e)}},a=async(e,t)=>{switch(e){case N.session_cancel:{let e=Rn.parse(t);return r.cancel(e)}case N.document_did_open:{if(!r.unstable_didOpenDocument)return;let e=Wn.parse(t);return r.unstable_didOpenDocument(e)}case N.document_did_change:{if(!r.unstable_didChangeDocument)return;let e=kr.parse(t);return r.unstable_didChangeDocument(e)}case N.document_did_close:{if(!r.unstable_didCloseDocument)return;let e=Hn.parse(t);return r.unstable_didCloseDocument(e)}case N.document_did_save:{if(!r.unstable_didSaveDocument)return;let e=Gn.parse(t);return r.unstable_didSaveDocument(e)}case N.document_did_focus:{if(!r.unstable_didFocusDocument)return;let e=Un.parse(t);return r.unstable_didFocusDocument(e)}case N.nes_accept:{if(!r.unstable_acceptNes)return;let e=Ln.parse(t);return r.unstable_acceptNes(e)}case N.nes_reject:{if(!r.unstable_rejectNes)return;let e=Xn.parse(t);return r.unstable_rejectNes(e)}default:if(r.extNotification)return r.extNotification(e,t);throw K.methodNotFound(e)}};this.connection=new bi(i,a,n)}async sessionUpdate(e){return await this.connection.sendNotification(P.session_update,e)}async requestPermission(e){return await this.connection.sendRequest(P.session_request_permission,e)}async readTextFile(e){return await this.connection.sendRequest(P.fs_read_text_file,e)}async writeTextFile(e){return await this.connection.sendRequest(P.fs_write_text_file,e)??{}}async createTerminal(e){return new yi((await this.connection.sendRequest(P.terminal_create,e)).terminalId,e.sessionId,this.connection)}async unstable_createElicitation(e){return await this.connection.sendRequest(P.elicitation_create,e)}async unstable_completeElicitation(e){return await this.connection.sendNotification(P.elicitation_complete,e)}async extMethod(e,t){return await this.connection.sendRequest(e,t)}async extNotification(e,t){return await this.connection.sendNotification(e,t)}get signal(){return this.connection.signal}get closed(){return this.connection.closed}};_i=Symbol.asyncDispose;var yi=class{constructor(e,n,r){t(this,`id`,void 0),t(this,`sessionId`,void 0),t(this,`connection`,void 0),this.id=e,this.sessionId=n,this.connection=r}async currentOutput(){return await this.connection.sendRequest(P.terminal_output,{sessionId:this.sessionId,terminalId:this.id})}async waitForExit(){return await this.connection.sendRequest(P.terminal_wait_for_exit,{sessionId:this.sessionId,terminalId:this.id})}async kill(){return await this.connection.sendRequest(P.terminal_kill,{sessionId:this.sessionId,terminalId:this.id})??{}}async release(){return await this.connection.sendRequest(P.terminal_release,{sessionId:this.sessionId,terminalId:this.id})??{}}async[_i](){await this.release()}},bi=class{constructor(e,n,r){t(this,`pendingResponses`,new Map),t(this,`nextRequestId`,0),t(this,`requestHandler`,void 0),t(this,`notificationHandler`,void 0),t(this,`stream`,void 0),t(this,`writeQueue`,Promise.resolve()),t(this,`abortController`,new AbortController),t(this,`closedPromise`,void 0),this.requestHandler=e,this.notificationHandler=n,this.stream=r,this.closedPromise=new Promise(e=>{this.abortController.signal.addEventListener(`abort`,()=>e())}),this.receive()}get signal(){return this.abortController.signal}get closed(){return this.closedPromise}async receive(){let e;try{let e=this.stream.readable.getReader();try{for(;!this.abortController.signal.aborted;){let{value:t,done:n}=await e.read();if(n)break;if(t)try{this.processMessage(t)}catch(e){console.error(`Unexpected error during message processing:`,t,e),`id`in t&&t.id!==void 0&&this.sendMessage({jsonrpc:`2.0`,id:t.id,error:{code:-32700,message:`Parse error`}})}}}finally{e.releaseLock()}}catch(t){e=t}finally{this.close(e)}}close(e){if(this.abortController.signal.aborted)return;let t=e??Error(`ACP connection closed`);for(let e of this.pendingResponses.values())e.reject(t);this.pendingResponses.clear(),this.abortController.abort(t)}async processMessage(e){if(`method`in e&&`id`in e){let t=await this.tryCallRequestHandler(e.method,e.params);`error`in t&&console.error(`Error handling request`,e,t.error),await this.sendMessage({jsonrpc:`2.0`,id:e.id,...t})}else if(`method`in e){let t=await this.tryCallNotificationHandler(e.method,e.params);`error`in t&&console.error(`Error handling notification`,e,t.error)}else`id`in e?this.handleResponse(e):console.error(`Invalid message`,{message:e})}async tryCallRequestHandler(e,t){try{return{result:await this.requestHandler(e,t)??null}}catch(e){if(e instanceof K)return e.toResult();if(e instanceof S)return K.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return K.internalError(t?JSON.parse(t):{}).toResult()}catch{return K.internalError({details:t}).toResult()}}}async tryCallNotificationHandler(e,t){try{return await this.notificationHandler(e,t),{result:null}}catch(e){if(e instanceof K)return e.toResult();if(e instanceof S)return K.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return K.internalError(t?JSON.parse(t):{}).toResult()}catch{return K.internalError({details:t}).toResult()}}}handleResponse(e){let t=this.pendingResponses.get(e.id);if(t){if(`result`in e)t.resolve(e.result);else if(`error`in e){let{code:n,message:r,data:i}=e.error;t.reject(new K(n,r,i))}this.pendingResponses.delete(e.id)}else console.error(`Got response to unknown request`,e.id)}sendRequest(e,t){this.throwIfClosed();let n=this.nextRequestId++,r=new Promise((e,t)=>{this.pendingResponses.set(n,{resolve:e,reject:t})});return r.catch(()=>{}),this.sendMessage({jsonrpc:`2.0`,id:n,method:e,params:t}),r}async sendNotification(e,t){this.throwIfClosed(),await this.sendMessage({jsonrpc:`2.0`,method:e,params:t})}throwIfClosed(){if(this.abortController.signal.aborted)throw this.abortController.signal.reason??Error(`ACP connection closed`)}async sendMessage(e){return this.writeQueue=this.writeQueue.then(async()=>{let t=this.stream.writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(e=>{this.close(e)}),this.writeQueue}},K=class e extends Error{constructor(e,n,r){super(n),t(this,`code`,void 0),t(this,`data`,void 0),this.code=e,this.name=`RequestError`,this.data=r}static parseError(t,n){return new e(-32700,`Parse error${n?`: ${n}`:``}`,t)}static invalidRequest(t,n){return new e(-32600,`Invalid request${n?`: ${n}`:``}`,t)}static methodNotFound(t){return new e(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,n){return new e(-32602,`Invalid params${n?`: ${n}`:``}`,t)}static internalError(t,n){return new e(-32603,`Internal error${n?`: ${n}`:``}`,t)}static authRequired(t,n){return new e(-32e3,`Authentication required${n?`: ${n}`:``}`,t)}static resourceNotFound(t){return new e(-32002,`Resource not found${t?`: ${t}`:``}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}};se(),k(),ue(),ve(),de(),m(),_(),g(),n(),c(),h(),xe();function q(e,t){if(e)return t?ke(e)?e:Ae(t,e):e}var xi=!(typeof process.geteuid==`function`?process.geteuid()===0:typeof process.getuid==`function`&&process.getuid()===0)||!!process.env.IS_SANDBOX,Si={auto:`auto`,default:`default`,acceptedits:`acceptEdits`,dontask:`dontAsk`,plan:`plan`,bypasspermissions:`bypassPermissions`,bypass:`bypassPermissions`};function Ci(e,t=`permissions.defaultMode`){if(e===void 0)return`default`;if(typeof e!=`string`)throw Error(`Invalid ${t}: expected a string.`);let n=e.trim().toLowerCase();if(n===``)throw Error(`Invalid ${t}: expected a non-empty string.`);let r=Si[n];if(!r)throw Error(`Invalid ${t}: ${e}.`);if(r===`bypassPermissions`&&!xi)throw Error(`Invalid ${t}: bypassPermissions is not available when running as root.`);return r}function wi(e){let t=[...e.mcpServers??[]].sort((e,t)=>e.name.localeCompare(t.name));return JSON.stringify({cwd:e.cwd,mcpServers:t})}var Ti=256;function Ei(e){let t=e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim();return t.length<=Ti?t:t.slice(0,Ti-1)+`…`}function J(e,t){if(!t)return e;let n=M.resolve(t),r=M.resolve(e);return r.startsWith(n+M.sep)||r===n?M.relative(n,r):e}function Di(e){let t="```";for(let n of e.matchAll(/^```+/gm)??[])for(;n[0].length>=t.length;)t+="`";return t+`
|
|
4
|
-
`+e+(e.endsWith(`
|
|
5
|
-
`)?``:`
|
|
6
|
-
`)+t}function Y(e,t=!1,n){let r=e.name,i=e.input;switch(r){case`Agent`:case`Task`:{let e=i?.description??`Task`,t=i?.prompt;return{title:e,kind:`think`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Bash`:{let e=i?.command??`Terminal`,t=i?.description;return{title:e,kind:`execute`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Read`:{let e=i?.file_path,t=e??`File`,r=i?.offset,a=i?.limit,o=``;a&&a>0?o=` (${r??1} - ${(r??1)+a-1})`:r&&(o=` (from line ${r})`);let s=t?J(t,n):`File`,c=q(e,n);return{title:`Read ${s}${o}`,kind:`read`,locations:c?[{path:c,line:r??1}]:[],content:[]}}case`Write`:{let e=i?.file_path??``,t=i?.content??``,r=e?J(e,n):void 0,a=q(e,n);return{title:r?`Write ${r}`:`Write`,kind:`edit`,content:a?[{type:`diff`,path:a,oldText:null,newText:t}]:[{type:`content`,content:{type:`text`,text:t}}],locations:a?[{path:a}]:[]}}case`Edit`:{let e=i?.file_path??``,t=i?.old_string??``,r=i?.new_string??``,a=e?J(e,n):void 0,o=q(e,n);return{title:a?`Edit ${a}`:`Edit`,kind:`edit`,content:o?[{type:`diff`,path:o,oldText:t||null,newText:r}]:[],locations:o?[{path:o}]:[]}}case`Glob`:{let e=i?.path??``,t=i?.pattern??``,r=q(e,n),a=`Find`;return e&&(a+=` \`${e}\``),t&&(a+=` \`${t}\``),{title:a,kind:`search`,content:[],locations:r?[{path:r}]:[]}}case`Grep`:{let e=i?.pattern??``,t=i?.path??``,n=`grep`;return i?.[`-i`]&&(n+=` -i`),i?.[`-n`]&&(n+=` -n`),i?.[`-A`]!==void 0&&(n+=` -A ${i[`-A`]}`),i?.[`-B`]!==void 0&&(n+=` -B ${i[`-B`]}`),i?.[`-C`]!==void 0&&(n+=` -C ${i[`-C`]}`),i?.output_mode===`files_with_matches`?n+=` -l`:i?.output_mode===`count`&&(n+=` -c`),i?.head_limit!==void 0&&(n+=` | head -${i.head_limit}`),i?.glob&&(n+=` --include="${i.glob}"`),i?.type&&(n+=` --type=${i.type}`),i?.multiline&&(n+=` -P`),e&&(n+=` "${e}"`),t&&(n+=` ${t}`),{title:n,kind:`search`,content:[]}}case`TodoWrite`:{let e=i?.todos;return{title:Array.isArray(e)?`Update TODOs: ${e.map(e=>e.content).join(`, `)}`:`Update TODOs`,kind:`think`,content:[]}}case`ExitPlanMode`:{let e=i?.plan;return{title:`Ready to code?`,kind:`switch_mode`,content:e?[{type:`content`,content:{type:`text`,text:e}}]:[]}}default:return{title:r||`Unknown Tool`,kind:`other`,content:[]}}}function Oi(e,t){return Array.isArray(e)&&e.length>0?{content:e.map(e=>({type:`content`,content:ki(e,t)}))}:typeof e==`string`&&e.length>0?{content:[{type:`content`,content:{type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e}}]}:{}}function ki(e,t){let n=e=>({type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e});switch(e.type){case`text`:{let n=e.text;return{type:`text`,text:t?`\`\`\`\n${n}\n\`\`\``:n}}case`image`:{let t=e.source;return t?.type===`base64`?{type:`image`,data:t.data,mimeType:t.media_type}:n(t?.type===`url`?`[image: ${t.url}]`:`[image: file reference]`)}case`resource_link`:{let t=e.uri;return{type:`resource_link`,uri:t,name:e.name??t,mimeType:e.mimeType}}case`resource`:{let t=e.resource;return{type:`resource`,resource:{uri:t?.uri??``,mimeType:t?.mimeType,...typeof t?.text==`string`?{text:t.text}:{},...typeof t?.blob==`string`?{blob:t.blob}:{}}}}case`tool_reference`:return n(`Tool: ${e.tool_name}`);case`tool_search_tool_search_result`:{let t=e.tool_references;return n(`Tools found: ${t?.map(e=>e.tool_name).join(`, `)||`none`}`)}case`tool_search_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);case`web_fetch_result`:return n(`Fetched: ${e.url}`);case`web_fetch_tool_result_error`:return n(`Error: ${e.error_code}`);case`code_execution_result`:case`bash_code_execution_result`:return n(`Output: ${e.stdout||e.stderr||``}`);case`code_execution_tool_result_error`:case`bash_code_execution_tool_result_error`:return n(`Error: ${e.error_code}`);case`text_editor_code_execution_view_result`:return n(e.content);case`text_editor_code_execution_create_result`:return n(e.is_file_update?`File updated`:`File created`);case`text_editor_code_execution_str_replace_result`:{let t=e.lines;return n(t?.join(`
|
|
7
|
-
`)||``)}case`text_editor_code_execution_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);default:try{return{type:`text`,text:JSON.stringify(e)}}catch{return{type:`text`,text:`[content]`}}}}function Ai(e,t,n=!1){if(!t)return{};let r=e.is_error===!0,i=e.content;if(r&&i)return Oi(i,!0);switch(t.name){case`Read`:return typeof i==`string`&&i.length>0?{content:[{type:`content`,content:{type:`text`,text:Di(i)}}]}:Array.isArray(i)&&i.length>0?{content:i.map(e=>({type:`content`,content:e.type===`text`?{type:`text`,text:Di(e.text)}:ki(e,!1)}))}:{};case`Bash`:{let e=``;if(i&&typeof i==`object`&&!Array.isArray(i)&&i.type===`bash_code_execution_result`){let t=i;e=[t.stdout,t.stderr].filter(Boolean).join(`
|
|
8
|
-
`)}else typeof i==`string`?e=i:Array.isArray(i)&&i.length>0&&(e=i.map(e=>e.type===`text`?e.text:``).join(`
|
|
9
|
-
`));return e.trim()?{content:[{type:`content`,content:{type:`text`,text:`\`\`\`console\n${e.trimEnd()}\n\`\`\``}}]}:{}}case`Edit`:case`Write`:return{};case`ExitPlanMode`:return{title:`Exited Plan Mode`};default:return Oi(i??``,r)}}function ji(e){return e===`in_progress`?`in_progress`:e===`completed`?`completed`:`pending`}function X(e,t,n,r,i,a,o){let s=[];for(let i of e){let e=i.type,a=null;switch(e){case`text`:case`text_delta`:{let e=i.text??``;a={sessionUpdate:t===`assistant`?`agent_message_chunk`:`user_message_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`text`,text:e}};break}case`thinking`:case`thinking_delta`:{let e=i.thinking??``;a={sessionUpdate:`agent_thought_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`text`,text:e}};break}case`image`:{let e=i.source;e?.type===`base64`&&(a={sessionUpdate:t===`assistant`?`agent_message_chunk`:`user_message_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`image`,data:e.data,mimeType:e.media_type}});break}case`tool_use`:case`server_tool_use`:case`mcp_tool_use`:{let t=i.id??``,n=i.name??`unknown`,s=i.input,c=t in r;if(r[t]={type:e,id:t,name:n,input:s},n===`TodoWrite`){let e=s?.todos;Array.isArray(e)&&(a={sessionUpdate:`plan`,entries:e.map(e=>({content:e.content,status:ji(e.status),priority:`medium`}))})}else{let e=s?{...s}:{};a=c?{_meta:{claudeCode:{toolName:n}},toolCallId:t,sessionUpdate:`tool_call_update`,status:`in_progress`,rawInput:e,...Y({name:n,id:t,input:s??{}},!1,o?.cwd)}:{_meta:{claudeCode:{toolName:n}},toolCallId:t,sessionUpdate:`tool_call`,rawInput:e,status:`pending`,...Y({name:n,id:t,input:s??{}},!1,o?.cwd)}}break}case`tool_result`:case`mcp_tool_result`:{let e=i.tool_use_id??``,t=r[e];if(!t)break;if(t.name!==`TodoWrite`){let n=Ai(i,{name:t.name,id:t.id},!1);a={_meta:{claudeCode:{toolName:t.name}},toolCallId:e,sessionUpdate:`tool_call_update`,status:i.is_error===!0?`failed`:`completed`,rawOutput:i.content,...n}}break}case`redacted_thinking`:case`input_json_delta`:case`citations_delta`:case`signature_delta`:case`container_upload`:case`compaction`:case`compaction_delta`:break}if(a){if(o?.parentToolUseId){let e=a._meta;a._meta={...e,claudeCode:{...e?.claudeCode??{},parentToolUseId:o.parentToolUseId}}}s.push({sessionId:n,update:a})}}return s}function Mi(e,t,n,r,i){let a=e.message;if(!a)return[];let o=a.content;if(!o)return[];if(typeof o==`string`)return[{sessionId:t,update:{sessionUpdate:`agent_message_chunk`,...i?.messageId?{messageId:i.messageId}:{},content:{type:`text`,text:o}}}];let s=i?.streamingActive?o.filter(e=>e.type!==`text`&&e.type!==`thinking`):o;return s.length===0?[]:X(s,`assistant`,t,n,r,void 0,i)}function Ni(e,t,n,r,i){let a=e.event;if(!a)return[];switch(a.type){case`content_block_start`:{let o=a.content_block;return o?X([o],`assistant`,t,n,r,void 0,{clientCapabilities:i?.clientCapabilities,parentToolUseId:e.parent_tool_use_id,cwd:i?.cwd,messageId:i?.messageId}):[]}case`content_block_delta`:{let o=a.delta;return o?X([o],`assistant`,t,n,r,void 0,{clientCapabilities:i?.clientCapabilities,parentToolUseId:e.parent_tool_use_id,cwd:i?.cwd,messageId:i?.messageId}):[]}case`message_start`:case`message_delta`:case`message_stop`:case`content_block_stop`:return[];default:return[]}}function Pi(e,t){let n=0,r=Math.min(e.length,t.length);for(;n<r&&e[n]===t[n];)n++;return n}function Fi(e,t){let n=null,r=0;for(let i of Object.keys(e)){let e=Pi(i,t);e>r&&(r=e,n=i)}return n?e[n]??null:null}var Ii=console;function Li(e,t){if(t.aborted)return Promise.resolve({done:!0,value:void 0});let n,r=new Promise(e=>{n=()=>e({done:!0,value:void 0}),t.addEventListener(`abort`,n,{once:!0})});return Promise.race([e.next(),r]).finally(()=>{n&&t.removeEventListener(`abort`,n)})}async function Ri(e,t,n,r,i,a,o,s){let c=`end_turn`,l={inputTokens:0,outputTokens:0,cachedReadTokens:0,cachedWriteTokens:0},u=null,d=null,f=2e5,p=!1,m=null;try{for(;!r.aborted;){let s=await Li(t,r);if(s.done||r.aborted)break;let h=s.value;if(h==null)continue;let g=h;switch(g.type){case`system`:g.subtype===`compact_boundary`&&(u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
|
|
10
|
-
|
|
11
|
-
Compacting completed.`}}}));break;case`result`:{let t=g.usage;t&&(l.inputTokens+=t.input_tokens??0,l.outputTokens+=t.output_tokens??0,l.cachedReadTokens+=t.cache_read_input_tokens??0,l.cachedWriteTokens+=t.cache_creation_input_tokens??0);let i=g.modelUsage;if(i&&d){let e=Fi(i,d);e?.contextWindow&&(f=e.contextWindow)}u!==null&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`usage_update`,used:u,size:f}});let a=g.subtype,o=g.is_error;if(r.aborted){c=`cancelled`;break}switch(a){case`success`:{let e=g.stop_reason;c=e===`max_tokens`?`max_tokens`:e===`refusal`?`refusal`:`end_turn`,o&&(c=`end_turn`);break}case`error_during_execution`:c=g.stop_reason===`max_tokens`?`max_tokens`:`end_turn`;break;case`error_max_budget_usd`:case`error_max_turns`:case`error_max_structured_output_retries`:c=`max_turn_requests`;break}break}case`stream_event`:{let t=g.parent_tool_use_id;t===null&&m===null&&(m=j());let r=Ni(g,e,i,n,{clientCapabilities:a,cwd:o,messageId:t===null?m??void 0:void 0});for(let e of r)await n.sessionUpdate(e);p=!0;break}case`assistant`:{let t=g.message,r=g.parent_tool_use_id;if(t?.usage&&r===null){let e=t.usage;u=(typeof e.input_tokens==`number`?e.input_tokens:0)+(typeof e.output_tokens==`number`?e.output_tokens:0)+(typeof e.cache_read_input_tokens==`number`?e.cache_read_input_tokens:0)+(typeof e.cache_creation_input_tokens==`number`?e.cache_creation_input_tokens:0)}r===null&&t?.model&&t.model!==`<synthetic>`&&(d=t.model);let s;r===null&&(m===null&&(m=j()),s=m);let c=Mi(g,e,i,n,{clientCapabilities:a,cwd:o,parentToolUseId:r,streamingActive:p,messageId:s});for(let e of c)await n.sessionUpdate(e);r===null&&(m=null);break}case`user`:break;case`progress`:{let t=g.data;if(!t)break;let r=t.type;if(r===`agent_progress`||r===`skill_progress`){let r=t.message;if(r){let t=r.content;if(t)for(let r of t)r.type===`text`&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:r.text}}})}}break}case`tool_use_summary`:break;case`attachment`:break;case`compact_boundary`:u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
|
|
12
|
-
|
|
13
|
-
Compacting completed.`}}});break;default:Ii.debug(`Ignoring unknown SDK message type`);break}}if(r.aborted||s?.())return{stopReason:`cancelled`,usage:l}}catch(e){if(r.aborted)return{stopReason:`cancelled`,usage:l};throw e}return{stopReason:c,usage:l}}async function zi(e,t,n,r,i,a){for(let o of t){let t=o;if(t.type!==`user`&&t.type!==`assistant`){Ii.debug(`Ignoring unknown SDK message type`);continue}if(t.isMeta===!0)continue;let s=t.message?.content;if(!s)continue;let c=t.type===`assistant`?`assistant`:`user`;if(typeof s==`string`){if(!s.trim())continue;let t=j();await n.sessionUpdate({sessionId:e,update:{sessionUpdate:c===`assistant`?`agent_message_chunk`:`user_message_chunk`,...t?{messageId:t}:{},content:{type:`text`,text:s}}});continue}if(Array.isArray(s)){let t=X(s,c,e,r,n,void 0,{clientCapabilities:i,cwd:a,messageId:j()});for(let e of t)await n.sessionUpdate(e)}}}function Bi(e,t,n,r,i,a,o,c){return async(n,l,u,d,f,p)=>{let m=Hi(r);if(n.name===`ExitPlanMode`)return Vi(e,t,f,l,m,i,a,o,c);if(p!==void 0)return p;try{let e=await s(n,l,u,d,f);if(e.behavior===`allow`||e.behavior===`deny`)return e}catch(e){return console.error(`[ACP Permissions] Pipeline error:`,e),{behavior:`deny`,message:`Permission pipeline failed`,decisionReason:{type:`other`,reason:`Permission pipeline failed`},toolUseID:f}}let h=Y({name:n.name,id:f,input:l},m,i),g={toolCallId:f,title:h.title,kind:h.kind,status:`pending`,rawInput:l},_=[{kind:`allow_always`,name:`Always Allow`,optionId:`allow_always`},{kind:`allow_once`,name:`Allow`,optionId:`allow`},{kind:`reject_once`,name:`Reject`,optionId:`reject`},{kind:`reject_always`,name:`Always Reject`,optionId:`reject_always`}];try{let n=await e.requestPermission({sessionId:t,toolCall:g,options:_});if(n.outcome.outcome===`cancelled`)return c?.(),{behavior:`deny`,message:`Permission request cancelled by client`,decisionReason:{type:`mode`,mode:`default`},toolUseID:f};if(n.outcome.outcome===`selected`&&`optionId`in n.outcome&&n.outcome.optionId!==void 0){let e=n.outcome.optionId;if(e===`allow`||e===`allow_always`)return{behavior:`allow`,updatedInput:l}}return{behavior:`deny`,message:`Permission denied by client`,decisionReason:{type:`mode`,mode:`default`}}}catch(e){return console.error(`[ACP Permissions] Client request error:`,e),{behavior:`deny`,message:`Permission request failed`,decisionReason:{type:`mode`,mode:`default`}}}}}async function Vi(e,t,n,r,i,a,o,s,c){let l=[{kind:`allow_always`,name:`Yes, and use "auto" mode`,optionId:`auto`},{kind:`allow_always`,name:`Yes, and auto-accept edits`,optionId:`acceptEdits`},{kind:`allow_once`,name:`Yes, and manually approve edits`,optionId:`default`},{kind:`reject_once`,name:`No, keep planning`,optionId:`plan`}];s?.()===!0&&l.unshift({kind:`allow_always`,name:`Yes, and bypass permissions`,optionId:`bypassPermissions`});let u=Y({name:`ExitPlanMode`,id:n,input:r},i,a),d={toolCallId:n,title:u.title,kind:u.kind,status:`pending`,rawInput:r},f=await e.requestPermission({sessionId:t,toolCall:d,options:l});if(f.outcome.outcome===`cancelled`)return c?.(),{behavior:`deny`,message:`Tool use aborted`,decisionReason:{type:`mode`,mode:`default`}};if(f.outcome.outcome===`selected`&&`optionId`in f.outcome&&f.outcome.optionId!==void 0){let n=f.outcome.optionId;if(l.some(e=>e.optionId===n)&&(n==="default"||n===`acceptEdits`||n===`auto`||n===`bypassPermissions`))return o?.(n),await e.sessionUpdate({sessionId:t,update:{sessionUpdate:`current_mode_update`,currentModeId:n}}),{behavior:`allow`,updatedInput:r}}return{behavior:`deny`,message:`User rejected request to exit plan mode.`,decisionReason:{type:`mode`,mode:`plan`}}}function Hi(e){if(!e)return!1;if(e.terminal===!0)return!0;let t=e._meta;return!t||typeof t!=`object`?!1:t.terminal_output===!0}ge(),Ce(),te(),pe(),e(),i(),r();var Z=class{constructor(e){t(this,`conn`,void 0),t(this,`sessions`,new Map),t(this,`clientCapabilities`,void 0),this.conn=e}async initialize(e){return this.clientCapabilities=e.clientCapabilities,{protocolVersion:1,authMethods:[],agentInfo:{name:`workmate`,title:`Work Mate`,version:typeof globalThis.MACRO==`object`&&globalThis.MACRO!==null?String(globalThis.MACRO.VERSION??`0.0.0`):`0.0.0`},agentCapabilities:{_meta:{claudeCode:{promptQueueing:!0,forkSession:!0}},promptCapabilities:{image:!1,embeddedContext:!0},mcpCapabilities:{http:!0,sse:!0},loadSession:!0,sessionCapabilities:{list:{},resume:{},close:{},delete:{}}}}}async authenticate(e){return{}}async newSession(e){let t=await this.createSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async unstable_resumeSession(e){let t=await this.getOrCreateSession({...e,replay:!1});return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async loadSession(e){let t=await this.getOrCreateSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async listSessions(e){if(e.cursor!==void 0&&e.cursor!==null)throw Error(`Pagination cursor not supported: listSessions returns all results in a single page.`);let t=e.cwd||oe(),n=await he(t),r=await l({dir:t}),i=[];for(let e of r){if(!e.cwd||await he(e.cwd)!==n)continue;let t=Ei(e.summary??``);i.push({sessionId:e.sessionId,cwd:e.cwd,...t?{title:t}:{},updatedAt:new Date(e.lastModified).toISOString()})}return{sessions:i}}async unstable_forkSession(e){let{initialMessages:t}=await Ui(e.sessionId),n=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{initialMessages:t});return this.scheduleAvailableCommandsUpdate(n.sessionId),n}async unstable_closeSession(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return await this.teardownSession(e.sessionId),{}}async unstable_deleteSession(e){let t=await me(e.sessionId);if(t)try{await Oe(t.filePath)}catch(e){if(e.code!==`ENOENT`)throw e}return this.sessions.has(e.sessionId)&&await this.teardownSession(e.sessionId),{}}async extMethod(e,t){if(e===`session/delete`){let e=t.sessionId;if(typeof e!=`string`||e.length===0)throw Error(`session/delete requires a non-empty sessionId`);return this.unstable_deleteSession({sessionId:e})}throw K.methodNotFound(e)}async cancel(e){let t=this.sessions.get(e.sessionId);if(t){t.cancelled=!0,t.cancelGeneration+=1;for(let[,e]of t.pendingMessages)e.resolve(!0);t.pendingMessages.clear(),t.pendingQueue=[],t.pendingQueueHead=0,t.queryEngine.interrupt()}}async setSessionMode(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return this.applySessionMode(e.sessionId,e.modeId),await this.conn.sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:e.modeId}}),await this.updateConfigOption(e.sessionId,`mode`,e.modeId),{}}async unstable_setSessionModel(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);return t.queryEngine.setModel(e.modelId),await this.updateConfigOption(e.sessionId,`model`,e.modelId),{}}async sendAvailableCommandsUpdate(e){let t=this.sessions.get(e);if(!t)return;let n=t.commands.filter(e=>e.type===`prompt`&&!e.isHidden&&e.userInvocable!==!1).map(e=>({name:e.name,description:e.description,input:e.argumentHint?{hint:e.argumentHint}:void 0}));await this.conn.sessionUpdate({sessionId:e,update:{sessionUpdate:`available_commands_update`,availableCommands:n}})}scheduleAvailableCommandsUpdate(e){setTimeout(()=>{this.sendAvailableCommandsUpdate(e).catch(e=>{console.error(`[ACP] Failed to send available commands update:`,e)})},0)}};async function Ui(e){let t;try{let n=await u(e);n&&n.messages.length>0&&(t=o(n.messages))}catch(e){console.error(`[ACP] fork source load failed:`,e)}return{initialMessages:t}}var Wi=[`auto`,`default`,`acceptEdits`,`bypassPermissions`,`dontAsk`,`plan`];function Gi(e){return Wi.includes(e)}function Ki(e,t,n){if(t){let t=qi(e,`_meta.permissionMode`);if(t===`bypassPermissions`&&!Xi())throw Error(`Mode not available: bypassPermissions cannot run as root (start the agent as a non-root user, or set IS_SANDBOX=1).`);return t}return Ji(n)??`default`}function qi(e,t){if(e==null)throw Error(`Invalid ${t}: expected a string.`);return Ci(e,t)}function Ji(e){if(e!=null)try{return Ci(e,`permissions.defaultMode`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[ACP] Invalid permissions.defaultMode, using default:`,t);return}}function Yi(e,t){return!!e&&Object.hasOwn(e,t)}function Xi(){return Zi()}function Zi(){return process.env.IS_SANDBOX?!0:typeof process.geteuid==`function`?process.geteuid()!==0:typeof process.getuid!=`function`||process.getuid()!==0}function Qi(e,t){return[{id:`mode`,name:`Mode`,description:`Session permission mode`,category:`mode`,type:`select`,currentValue:e.currentModeId,options:e.availableModes.map(e=>({value:e.id,name:e.name,description:e.description}))},{id:`model`,name:`Model`,description:`AI model to use`,category:`model`,type:`select`,currentValue:t.currentModelId,options:t.availableModels.map(e=>({value:e.modelId,name:e.name,description:e.description??void 0}))}]}function $i(e){let t=[];if(!Array.isArray(e))return t;for(let n of e){if(typeof n!=`object`||!n)continue;let e=n;if(Array.isArray(e.options))for(let n of e.options)n&&typeof n==`object`&&typeof n.value==`string`&&t.push(n.value);else typeof n.value==`string`&&t.push(n.value)}return t}function Q(e){return e.conn}function $(e){return e.clientCapabilities}function ea(e,t,n,r){n===`mode`?t.modes={...t.modes,currentModeId:r}:n===`model`&&(t.models={...t.models,currentModelId:r})}k();function ta(){return le().permissions?.defaultMode}async function na(e,t={}){fe();let n=t.sessionId??j(),r=e.cwd;A(n,ce()),ie(r);let i=process.cwd(),o=!1;try{process.chdir(r),o=!0}catch{}ae(),be();try{let i=ye(),o=f(i),s=e._meta,c=Yi(s,`permissionMode`),l=Ki(c?s?.permissionMode:void 0,c,ta()),u=$(this),m=this.conn,h=Bi(m,n,()=>this.sessions.get(n)?.modes.currentModeId??`default`,u,r,e=>{this.applySessionMode(n,e)},()=>this.sessions.get(n)?.appState.toolPermissionContext.isBypassPermissionsModeAvailable??!1),g=Xi(),_={...d(),toolPermissionContext:{...i,mode:l,isBypassPermissionsModeAvailable:g}},[te,v]=await Promise.all([a(r),p(r)]);_.agentDefinitions=v;let y=new Se({cwd:r,tools:o,commands:te,mcpClients:[],agents:v.activeAgents,canUseTool:h,getAppState:()=>_,setAppState:e=>{let t=e(_);Object.assign(_,t)},readFileCache:new ee(500,50*1024*1024),includePartialMessages:!0,replayUserMessages:!0,initialMessages:t.initialMessages}),b={currentModeId:l,availableModes:[{id:`default`,name:`Default`,description:`Standard behavior, prompts for dangerous operations`},{id:`acceptEdits`,name:`Accept Edits`,description:`Auto-accept file edit operations`},{id:`plan`,name:`Plan Mode`,description:`Planning mode, no actual tool execution`},{id:`auto`,name:`Auto`,description:`Use a model classifier to approve/deny permission prompts.`},...g?[{id:`bypassPermissions`,name:`Bypass Permissions`,description:`Skip all permission checks`}]:[],{id:`dontAsk`,name:`Don't Ask`,description:`Don't prompt for permissions, deny if not pre-approved`}]},x=we(),S=_e(),C={availableModels:x.map(e=>({modelId:String(e.value??``),name:e.label??String(e.value??``),description:e.description??void 0})),currentModelId:S};y.setModel(S);let w=Qi(b,C),ne={queryEngine:y,cancelled:!1,cancelGeneration:0,cwd:r,modes:b,models:C,configOptions:w,promptRunning:!1,pendingMessages:new Map,pendingQueue:[],pendingQueueHead:0,toolUseCache:{},clientCapabilities:u,appState:_,commands:te,sessionFingerprint:wi({cwd:r,mcpServers:e.mcpServers})};return this.sessions.set(n,ne),{sessionId:n,modes:b,models:C,configOptions:w}}finally{o&&process.chdir(i)}}Object.assign(Z.prototype,{createSession:na}),i(),r(),k(),pe();async function ra(e){let t=e.replay!==!1,n=this.sessions.get(e.sessionId);if(n){if(wi({cwd:e.cwd,mcpServers:e.mcpServers})===n.sessionFingerprint){let r=await me(e.sessionId,e.cwd);return A(e.sessionId,r?Te(r.filePath):null),ie(e.cwd),t&&await this.replaySessionHistory(e),{sessionId:e.sessionId,modes:n.modes,models:n.models,configOptions:n.configOptions}}await this.teardownSession(e.sessionId)}let r=await me(e.sessionId,e.cwd),i=r?Te(r.filePath):null;A(e.sessionId,i),ie(e.cwd);let a;if(r)try{let t=await u(e.sessionId);t&&t.messages.length>0&&(a=o(t.messages))}catch(e){console.error(`[ACP] Failed to load session history:`,e)}let s=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{sessionId:e.sessionId,initialMessages:a});if(t&&a&&a.length>0){let t=this.sessions.get(e.sessionId);t&&await zi(e.sessionId,a,Q(this),t.toolUseCache,$(this),t.cwd)}return{sessionId:s.sessionId,modes:s.modes,models:s.models,configOptions:s.configOptions}}async function ia(e){this.sessions.get(e)&&(await this.cancel({sessionId:e}),this.sessions.delete(e))}async function aa(e){try{let t=await u(e.sessionId);if(!t||t.messages.length===0)return;let n=o(t.messages);if(n.length===0)return;let r=this.sessions.get(e.sessionId);if(!r)return;await zi(e.sessionId,n,Q(this),r.toolUseCache,$(this),r.cwd)}catch(e){console.error(`[ACP] Failed to replay session history:`,e)}}function oa(e,t){if(!Gi(t))throw Error(`Invalid mode: ${t}`);let n=this.sessions.get(e);if(n){if(t===`bypassPermissions`&&!n.appState.toolPermissionContext.isBypassPermissionsModeAvailable||!n.modes.availableModes.some(e=>e.id===t))throw Error(`Mode not available: ${t}`);n.modes={...n.modes,currentModeId:t},n.appState.toolPermissionContext={...n.appState.toolPermissionContext,mode:t}}}async function sa(e,t,n){let r=this.sessions.get(e);r&&(ea(this,r,t,n),r.configOptions=r.configOptions.map(e=>e.id===t&&typeof e.currentValue==`string`?{...e,currentValue:n}:e),await Q(this).sessionUpdate({sessionId:e,update:{sessionUpdate:`config_option_update`,configOptions:r.configOptions}}))}Object.assign(Z.prototype,{getOrCreateSession:ra,teardownSession:ia,replaySessionHistory:aa,applySessionMode:oa,updateConfigOption:sa});function ca(e){if(!e||e.length===0)return``;let t=[];for(let n of e){let e=n;if(e.type===`text`)t.push(String(e.text??``));else if(e.type===`resource_link`){let n=typeof e.name==`string`?e.name:void 0,r=typeof e.uri==`string`?e.uri:void 0;t.push(la(n,r))}else if(e.type===`resource`){let n=e.resource;if(n&&typeof n.text==`string`)t.push(n.text);else if(n&&typeof n.blob==`string`){let e=typeof n.mimeType==`string`?n.mimeType:`application/octet-stream`,r=typeof n.uri==`string`?n.uri:`(unknown uri)`;t.push(`Embedded resource: ${r} (${e}, base64 blob, ${n.blob.length} chars)`)}}}return t.filter(e=>e.length>0).join(`
|
|
14
|
-
`)}function la(e,t){let n=[];return e&&e.length>0&&n.push(`name=${e}`),t&&t.length>0&&n.push(`uri=${t}`),n.length>0?`Resource link: ${n.join(`, `)}`:`Resource link`}function ua(e){for(;e.pendingQueueHead<e.pendingQueue.length;){let t=e.pendingQueue[e.pendingQueueHead++];if(!t)continue;let n=e.pendingMessages.get(t);if(n)return e.pendingMessages.delete(t),da(e),n}da(e)}function da(e){if(e.pendingQueueHead!==0){if(e.pendingQueueHead>=e.pendingQueue.length){e.pendingQueue=[],e.pendingQueueHead=0;return}e.pendingQueueHead>1024&&e.pendingQueueHead*2>e.pendingQueue.length&&(e.pendingQueue=e.pendingQueue.slice(e.pendingQueueHead),e.pendingQueueHead=0)}}k();async function fa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session ${e.sessionId} not found`);let n=e.messageId??void 0,r=ca(e.prompt);if(!r.trim())throw Error(`Prompt content is empty`);let i=t.cancelGeneration;if(t.promptRunning){let e=j();if(await new Promise(n=>{t.pendingQueue.push(e),t.pendingMessages.set(e,{resolve:n})}))return{stopReason:`cancelled`}}if(t.cancelGeneration!==i)return{stopReason:`cancelled`};t.cancelled=!1,t.promptRunning=!0;try{t.queryEngine.resetAbortController(),A(e.sessionId,ce());let i=t.queryEngine.submitMessage(r),{stopReason:a,usage:o}=await Ri(e.sessionId,i,Q(this),t.queryEngine.getAbortSignal(),t.toolUseCache,$(this),t.cwd,()=>t.cancelled);if(t.cancelled)return{stopReason:`cancelled`};if(await ma(this,e.sessionId,r),o){let e={inputTokens:o.inputTokens,outputTokens:o.outputTokens,cachedReadTokens:o.cachedReadTokens,cachedWriteTokens:o.cachedWriteTokens,thoughtTokens:0,totalTokens:o.inputTokens+o.outputTokens+o.cachedReadTokens+o.cachedWriteTokens+0};return{stopReason:a,usage:e,...n?{userMessageId:n}:{},_meta:{claudeCode:{usage:e}}}}return{stopReason:a,...n?{userMessageId:n}:{}}}catch(n){let r=n instanceof Error&&(n.name===`AbortError`||/abort|cancelled|interrupt/i.test(n.message));if(t.cancelled||r)return{stopReason:`cancelled`};throw n instanceof Error&&(n.message.includes(`terminated`)||n.message.includes(`process exited`))?(await this.teardownSession(e.sessionId),Error(`The Claude Agent process exited unexpectedly. Please start a new session.`)):n}finally{let e=ua(t);e?(t.promptRunning=!0,e.resolve(!1)):t.promptRunning=!1}}async function pa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);if(typeof e.value!=`string`)throw Error(`Invalid value for config option ${e.configId}: ${String(e.value)}`);let n=t.configOptions.find(t=>t.id===e.configId);if(!n)throw Error(`Unknown config option: ${e.configId}`);if(n.type===`select`){let t=$i(n.options);if(!t.includes(e.value))throw Error(`Invalid value '${e.value}' for config option ${e.configId}; must be one of: ${t.join(`, `)}`)}let r=e.value;return e.configId===`mode`?(this.applySessionMode(e.sessionId,r),await Q(this).sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:r}})):e.configId===`model`&&t.queryEngine.setModel(r),ea(this,t,e.configId,r),t.configOptions=t.configOptions.map(t=>t.id===e.configId&&typeof t.currentValue==`string`?{...t,currentValue:r}:t),{configOptions:t.configOptions}}async function ma(e,t,n){let r=e.sessions.get(t);if(!r)return;let i=r.toolUseCache;if(i.__sessionInfoTitleSent)return;i.__sessionInfoTitleSent=!0;let a=Ei(n).slice(0,100);try{await Q(e).sessionUpdate({sessionId:t,update:{sessionUpdate:`session_info_update`,...a?{title:a}:{},updatedAt:new Date().toISOString()}})}catch(e){console.error(`[ACP] Failed to send session_info_update:`,e)}}Object.assign(Z.prototype,{prompt:fa,setSessionConfigOption:pa}),de(),xe();function ha(e,t){let n=Ee.toWeb(e);return gi(De.toWeb(t),n)}async function ga(){fe(),be();let e=ha(process.stdin,process.stdout),t,n=new vi(e=>(t=new Z(e),t),e);console.log=console.error,console.info=console.error,console.warn=console.error,console.debug=console.error;async function r(){for(let[e]of t.sessions)try{await t.unstable_closeSession({sessionId:e})}catch{}process.exit(0)}n.closed.then(r).catch(r),process.on(`SIGTERM`,r),process.on(`SIGINT`,r),process.on(`unhandledRejection`,(e,t)=>{console.error(`Unhandled Rejection at:`,t,`reason:`,e)}),process.stdin.resume()}export{ga as runAcpAgent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{l as r,o as i}from"./envUtils-DcaKZlRU.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{E as s,O as c,S as l,i as u,l as d,n as f,s as p,v as m}from"./esm-lWlUmoUA.js";import{C as h,D as g,E as _,I as v,O as y,S as ee,V as te,_ as ne,a as b,d as re,k as ie,l as ae,n as oe,p as se,s as ce,t as le,w as ue,x as de,y as x}from"./esm-Cb-L4oAk.js";import{a as S,r as fe,t as pe}from"./esm-Bx6rTxIs.js";import{C as me,R as he,Wt as ge,pt as _e,tt as ve}from"./state-BPFYBqm1.js";import{C as ye,R as be,i as xe,x as Se}from"./debug-Dr1SjdXn.js";import{Gt as Ce,Kt as C,Yt as we,qt as Te}from"./settings-DiBMs2gM.js";import{d as Ee,m as De}from"./git-CoQQ6YEf.js";import{r as Oe,t as ke}from"./execFileNoThrow-mXq4K0rl.js";import{a as Ae,n as je,o as Me,r as Ne}from"./platform-Dg1c9F_1.js";import{An as Pe,Bt as Fe,Ft as Ie,Gt as Le,_ as Re,jn as ze,u as Be}from"./model-CDnVaVDR.js";import{i as Ve,t as He}from"./genericProcessUtils-Dc1pfb7J.js";import{arch as Ue,hostname as We,platform as Ge,release as Ke}from"os";import{extname as qe}from"path";import{stat as Je}from"fs/promises";import{inspect as Ye}from"util";import*as Xe from"process";import{AsyncLocalStorage as Ze}from"async_hooks";function Qe(){return process.platform===`linux`&&r(process.env.CLAUDE_CODE_BUBBLEWRAP)}function $e(){return process.platform===`linux`?w??!1:!1}async function et(){if(T!==void 0)return T;if(process.platform===`darwin`)return T=null,null;try{let e=await He(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of Ce)if(e.includes(t))return T=t,t}}catch{}return T=null,null}async function tt(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&C.platform!==`darwin`?await et()||`pycharm`:C.terminal}function nt(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&C.platform!==`darwin`?T===void 0?`pycharm`:T||`pycharm`:C.terminal}async function rt(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await et()}var it,w,T,E,at=e((()=>{n(),we(),i(),Oe(),Ve(),it=t(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await ke(`test`,[`-f`,`/.dockerenv`]);return e===0}),w=null,process.platform===`linux`&&Je(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{w=!0},()=>{w=!1}),E={...C,terminal:nt(),getIsDocker:it,getIsBubblewrapSandbox:Qe,isMuslEnvironment:$e,getTerminalWithJetBrainsDetectionAsync:tt,initJetBrainsDetection:rt}}));function ot(e){return st?.has(e)??!1}var st,ct=e((()=>{xe(),be()}));function D(){return O.getStore()}function lt(e,t){return O.run(e,t)}function ut(e){return e?.agentType===`subagent`}function dt(){let e=D();if(!(!ut(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function ft(){let e=D();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var O,pt=e((()=>{O=new Ze}));function mt(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function ht(){return r(process.env.OTEL_LOG_TOOL_DETAILS)}function gt(e,t){return!!(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&ot(t))}function _t(e,t,n){let r=vt(e);return!r||!Et.has(r.serverName)&&!gt(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function vt(e){if(!e.startsWith(`mcp__`))return;let t=e.split(`__`);if(t.length<3)return;let n=t[1],r=t.slice(2).join(`__`);if(!(!n||!r))return{serverName:n,mcpToolName:r}}function yt(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function k(e,t=0){if(typeof e==`string`)return e.length>Dt?`${e.slice(0,Ot)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=kt)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,M).map(e=>k(e,t+1));return e.length>M&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,M).map(([e,n])=>[e,k(n,t+1)]);return n.length>M&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function bt(e){if(!ht())return;let t=ye(k(e));return t.length>j&&(t=t.slice(0,j)+`…[truncated]`),t}function A(e){let t=qe(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>At?`other`:n}function xt(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=A(t);e&&(r.add(e),n=e)}for(let t of e.split(Mt)){if(!t)continue;let e=t.split(Nt);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(jt.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=A(i);a&&!r.has(a)&&(r.add(a),n=n?n+`,`+a:a)}}if(n)return n}function St(){let e=D();if(e)return{agentId:e.agentId,parentSessionId:e.parentSessionId,agentType:e.agentType};let t=process.env.CLAUDE_CODE_AGENT_ID,n=process.env.CLAUDE_CODE_PARENT_SESSION_ID,r=t?`standalone`:void 0;if(t||r||n)return{...t?{agentId:t}:{},...r?{agentType:r}:{},...n?{parentSessionId:n}:{}};let i=ve();return i?{parentSessionId:i}:{}}function Ct(){try{let e=process.memoryUsage(),t=process.cpuUsage(),n=Date.now(),r;if(N&&P){let e=n-P;e>0&&(r=(t.user-N.user+(t.system-N.system))/(e*1e3)*100)}return N=t,P=n,{uptime:process.uptime(),rss:e.rss,heapTotal:e.heapTotal,heapUsed:e.heapUsed,external:e.external,arrayBuffers:e.arrayBuffers,constrainedMemory:process.constrainedMemory(),cpuUsage:t,cpuPercent:r}}catch{return}}async function wt(e={}){let t=e.model?String(e.model):Be(),n=typeof e.betas==`string`?e.betas:Pe(t).join(`,`),[r,i]=await Promise.all([Ft(),Ee()]),a=Ct();return{model:t,sessionId:_e(),userType:process.env.USER_TYPE||``,...n.length>0?{betas:n}:{},envContext:r,...process.env.CLAUDE_CODE_ENTRYPOINT&&{entrypoint:process.env.CLAUDE_CODE_ENTRYPOINT},...process.env.CLAUDE_AGENT_SDK_VERSION&&{agentSdkVersion:process.env.CLAUDE_AGENT_SDK_VERSION},isInteractive:String(he()),clientType:me(),...a&&{processMetrics:a},sweBenchRunId:process.env.SWE_BENCH_RUN_ID||``,sweBenchInstanceId:process.env.SWE_BENCH_INSTANCE_ID||``,sweBenchTaskId:process.env.SWE_BENCH_TASK_ID||``,...St(),...Ie()&&{subscriptionType:Ie()},...i&&{rh:i}}}function Tt(e,t,n={}){let{envContext:r,processMetrics:i,rh:a,skillMode:o,observerMode:s,...c}=e,l={platform:r.platform,platform_raw:r.platformRaw,arch:r.arch,node_version:r.nodeVersion,terminal:r.terminal||`unknown`,package_managers:r.packageManagers,runtimes:r.runtimes,is_running_with_bun:r.isRunningWithBun,is_ci:r.isCi,is_claubbit:r.isClaubbit,is_claude_code_remote:r.isClaudeCodeRemote,is_local_agent_mode:r.isLocalAgentMode,is_conductor:r.isConductor,is_github_action:r.isGithubAction,is_claude_code_action:r.isClaudeCodeAction,is_claude_ai_auth:r.isClaudeAiAuth,version:r.version,build_time:r.buildTime,deployment_environment:r.deploymentEnvironment};r.remoteEnvironmentType&&(l.remote_environment_type=r.remoteEnvironmentType),r.claudeCodeContainerId&&(l.claude_code_container_id=r.claudeCodeContainerId),r.claudeCodeRemoteSessionId&&(l.claude_code_remote_session_id=r.claudeCodeRemoteSessionId),r.tags&&(l.tags=r.tags.split(`,`).map(e=>e.trim()).filter(Boolean)),r.githubEventName&&(l.github_event_name=r.githubEventName),r.githubActionsRunnerEnvironment&&(l.github_actions_runner_environment=r.githubActionsRunnerEnvironment),r.githubActionsRunnerOs&&(l.github_actions_runner_os=r.githubActionsRunnerOs),r.githubActionRef&&(l.github_action_ref=r.githubActionRef),r.wslVersion&&(l.wsl_version=r.wslVersion),r.linuxDistroId&&(l.linux_distro_id=r.linuxDistroId),r.linuxDistroVersion&&(l.linux_distro_version=r.linuxDistroVersion),r.linuxKernel&&(l.linux_kernel=r.linuxKernel),r.vcs&&(l.vcs=r.vcs),r.versionBase&&(l.version_base=r.versionBase);let u={session_id:c.sessionId,model:c.model,user_type:c.userType,is_interactive:c.isInteractive===`true`,client_type:c.clientType};if(c.betas&&(u.betas=c.betas),c.entrypoint&&(u.entrypoint=c.entrypoint),c.agentSdkVersion&&(u.agent_sdk_version=c.agentSdkVersion),c.sweBenchRunId&&(u.swe_bench_run_id=c.sweBenchRunId),c.sweBenchInstanceId&&(u.swe_bench_instance_id=c.sweBenchInstanceId),c.sweBenchTaskId&&(u.swe_bench_task_id=c.sweBenchTaskId),c.agentId&&(u.agent_id=c.agentId),c.parentSessionId&&(u.parent_session_id=c.parentSessionId),c.agentType&&(u.agent_type=c.agentType),t.githubActionsMetadata){let e=t.githubActionsMetadata;l.github_actions_metadata={actor_id:e.actorId,repository_id:e.repositoryId,repository_owner_id:e.repositoryOwnerId}}let d;return(t.accountUuid||t.organizationUuid)&&(d={account_uuid:t.accountUuid,organization_uuid:t.organizationUuid}),{env:l,...i&&{process:Buffer.from(ye(i)).toString(`base64`)},...d&&{auth:d},core:u,additional:{...a&&{rh:a},...o&&{skill_mode:o},...s&&{observer_mode:s},...n}}}var Et,Dt,Ot,j,M,kt,At,jt,Mt,Nt,Pt,Ft,N,P,It=e((()=>{n(),we(),at(),ze(),Re(),ge(),i(),ct(),Fe(),De(),Me(),pt(),Se(),Et=new Set,Dt=512,Ot=128,j=4*1024,M=20,kt=2,At=10,jt=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),Mt=/\s*(?:&&|\|\||[;|])\s*/,Nt=/\s+/,Pt=t(()=>{let e=`0.0.12`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),Ft=t(async()=>{let[e,t,n,i]=await Promise.all([C.getPackageManagers(),C.getRuntimes(),Ne(),je()]);return{platform:Te(),platformRaw:process.env.CLAUDE_CODE_HOST_PLATFORM||process.platform,arch:C.arch,nodeVersion:C.nodeVersion,terminal:E.terminal,packageManagers:e.join(`,`),runtimes:t.join(`,`),isRunningWithBun:C.isRunningWithBun(),isCi:r(process.env.CI),isClaubbit:r(process.env.CLAUBBIT),isClaudeCodeRemote:r(process.env.CLAUDE_CODE_REMOTE),isLocalAgentMode:process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`,isConductor:C.isConductor(),...process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE&&{remoteEnvironmentType:process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE},...process.env.CLAUDE_CODE_CONTAINER_ID&&{claudeCodeContainerId:process.env.CLAUDE_CODE_CONTAINER_ID},...process.env.CLAUDE_CODE_REMOTE_SESSION_ID&&{claudeCodeRemoteSessionId:process.env.CLAUDE_CODE_REMOTE_SESSION_ID},...process.env.CLAUDE_CODE_TAGS&&{tags:process.env.CLAUDE_CODE_TAGS},isGithubAction:r(process.env.GITHUB_ACTIONS),isClaudeCodeAction:r(process.env.CLAUDE_CODE_ACTION),isClaudeAiAuth:Le(),version:`0.0.12`,versionBase:Pt(),buildTime:`2026-08-13T05:57:11.301Z`,deploymentEnvironment:C.detectDeploymentEnvironment(),...r(process.env.GITHUB_ACTIONS)&&{githubEventName:process.env.GITHUB_EVENT_NAME,githubActionsRunnerEnvironment:process.env.RUNNER_ENVIRONMENT,githubActionsRunnerOs:process.env.RUNNER_OS,githubActionRef:process.env.GITHUB_ACTION_PATH?.includes(`claude-code-action/`)?process.env.GITHUB_ACTION_PATH.split(`claude-code-action/`)[1]:void 0},...Ae()&&{wslVersion:Ae()},...n??{},...i.length>0?{vcs:i.join(`,`)}:{}}}),N=null,P=null}));function Lt(e){return e.setValue(zt,!0)}function Rt(e){return e.getValue(zt)===!0}var zt,Bt=e((()=>{f(),zt=c(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)}));function Vt(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Ht(n)){p.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Ut(r)){p.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Ht(e){return typeof e==`string`&&e!==``}function Ut(e){return e==null?!0:Array.isArray(e)?Wt(e):Gt(typeof e)}function Wt(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Gt(e)){t=e;continue}return!1}return!1}}return!0}function Gt(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var Kt=e((()=>{f()}));function qt(){return e=>{p.error(Jt(e))}}function Jt(e){return typeof e==`string`?e:JSON.stringify(Yt(e))}function Yt(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var Xt=e((()=>{f()}));function Zt(e){try{Qt(e)}catch{}}var Qt,$t=e((()=>{Xt(),Qt=qt()}));function en(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){p.warn(`Unknown value ${Ye(t)} for ${e}, expected a number, using defaults`);return}return n}function F(e){let t=process.env[e];if(!(t==null||t.trim()===``))return t}var tn=e((()=>{f()})),nn,rn=e((()=>{nn=`2.9.0`})),an,on=e((()=>{an=`process.runtime.name`})),I,sn=e((()=>{rn(),x(),on(),I={[g]:`opentelemetry`,[an]:`node`,[_]:ie,[y]:nn}})),L,cn=e((()=>{tn(),sn(),L=performance})),ln=e((()=>{cn()}));function R(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*vn)]}function un(e){return gn(R(L.timeOrigin),R(typeof e==`number`?e:L.now()))}function dn(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=z),[n,r]}function fn(e){return e[0]*1e6+e[1]/1e3}function pn(e){return e[0]+e[1]/z}function mn(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function hn(e){return mn(e)||typeof e==`number`||e instanceof Date}function gn(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=z&&(n[1]-=z,n[0]+=1),n}var _n,vn,z,yn=e((()=>{ln(),_n=9,vn=10**6,z=10**_n})),B,bn=e((()=>{(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(B||(B={}))}));function xn(e){if(!Sn(e)||Cn(e)!==En)return!1;let t=An(e);if(t===null)return!0;let n=U.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&V.call(n)===kn}function Sn(e){return typeof e==`object`&&!!e}function Cn(e){return e==null?e===void 0?On:Dn:W&&W in Object(e)?wn(e):Tn(e)}function wn(e){let t=U.call(e,W),n=e[W],r=!1;try{e[W]=void 0,r=!0}catch{}let i=G.call(e);return r&&(t?e[W]=n:delete e[W]),i}function Tn(e){return G.call(e)}var En,Dn,On,V,kn,An,H,U,W,G,jn=e((()=>{En=`[object Object]`,Dn=`[object Null]`,On=`[object Undefined]`,V=Function.prototype.toString,kn=V.call(Object),An=Object.getPrototypeOf,H=Object.prototype,U=H.hasOwnProperty,W=Symbol?Symbol.toStringTag:void 0,G=H.toString}));function Mn(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=Nn(t,e.shift(),0,n);return t}function K(e){return q(e)?e.slice():e}function Nn(e,t,n=0,r){let i;if(!(n>Ln)){if(n++,Y(e)||Y(t)||Fn(t))i=K(t);else if(q(e)){if(i=e.slice(),q(t))for(let e=0,n=t.length;e<n;e++)i.push(K(t[e]));else if(J(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=K(t[r]))}}}else if(J(e))if(J(t)){if(!In(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(Y(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Pn(e,s,r)||Pn(t,s,r))delete i[s];else{if(J(a)&&J(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=Nn(i[s],c,n,r)}}}}else i=t;return i}}function Pn(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function q(e){return Array.isArray(e)}function Fn(e){return typeof e==`function`}function J(e){return!Y(e)&&!q(e)&&!Fn(e)&&typeof e==`object`}function Y(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function In(e,t){return!(!xn(e)||!xn(t))}var Ln,Rn=e((()=>{jn(),Ln=20})),zn,Bn=e((()=>{a(),zn=class{constructor(){o(this,`_promise`,void 0),o(this,`_resolve`,void 0),o(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}})),Vn,Hn=e((()=>{Bn(),a(),Vn=class{constructor(e,t){o(this,`_isCalled`,!1),o(this,`_deferred`,new zn),o(this,`_callback`,void 0),o(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}));function Un(e,t){return new Promise(n=>{d.with(Lt(d.active()),()=>{e.export(t,n)})})}var Wn=e((()=>{f(),Bt()})),Gn,X=e((()=>{Bt(),Kt(),$t(),Xt(),yn(),bn(),ln(),Rn(),Hn(),Wn(),Gn={_export:Un}}));function Kn(){if(Z===void 0)try{let e=globalThis.process.argv0;Z=e?`unknown_service:${e}`:`unknown_service`}catch{Z=`unknown_service`}return Z}var Z,qn=e((()=>{})),Q,Jn=e((()=>{Q=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}));function Yn(e,t){return er.FromAttributeList(Object.entries(e),t)}function Xn(){return Yn({[ue]:Kn(),[_]:I[_],[g]:I[g],[y]:I[y]})}function Zn(e){return e.map(([e,t])=>Q(t)?[e,t.catch(t=>{p.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Qn(e){if(typeof e==`string`||e===void 0)return e;p.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function $n(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;p.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var er,tr=e((()=>{f(),X(),x(),qn(),Jn(),a(),er=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Zn(t),r._asyncAttributesPending=t.filter(([e,t])=>Q(t)).length>0,r}constructor(e,t){o(this,`_rawAttributes`,void 0),o(this,`_asyncAttributesPending`,!1),o(this,`_schemaUrl`,void 0),o(this,`_memoizedAttributes`,void 0);let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Q(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Zn(this._rawAttributes),this._schemaUrl=Qn(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,Q(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&p.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Q(n)){p.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=$n(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}})),nr,rr,ir=e((()=>{f(),x(),X(),a(),nr=class{constructor(){o(this,`_MAX_LENGTH`,255),o(this,`_COMMA_SEPARATOR`,`,`),o(this,`_LABEL_KEY_VALUE_SPLITTER`,`=`)}detect(e){let t={},n=F(`OTEL_RESOURCE_ATTRIBUTES`),r=F(`OTEL_SERVICE_NAME`);if(n)try{let e=this._parseResourceAttributes(n);Object.assign(t,e)}catch(e){p.debug(`EnvDetector failed: ${e instanceof Error?e.message:e}`)}return r&&(t[ue]=r),{attributes:t}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR).filter(e=>e.trim()!==``);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER);if(n.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${e}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[r,i]=n,a=r.trim(),o=i.trim();if(a.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${e}".`);let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch(t){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${e}": ${t instanceof Error?t.message:t}`,{cause:t})}if(s.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${s}".`);if(c.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${s}".`);t[s]=c}return t}},rr=new nr})),ar,or,sr,cr,lr,ur=e((()=>{ar=`host.arch`,or=`host.id`,sr=`host.name`,cr=`os.type`,lr=`os.version`}));async function dr(){if(!$)switch(Xe.platform){case`darwin`:$=(await import(`./getMachineId-darwin-CsRhaP3y.js`)).getMachineId;break;case`linux`:$=(await import(`./getMachineId-linux-Bd7UBNRQ.js`)).getMachineId;break;case`freebsd`:$=(await import(`./getMachineId-bsd-Cut1kHoA.js`)).getMachineId;break;case`win32`:$=(await import(`./getMachineId-win-DamF2CH_.js`)).getMachineId;break;default:$=(await import(`./getMachineId-unsupported-vFGP8E_8.js`)).getMachineId;break}return $()}var $,fr=e((()=>{})),pr,mr,hr=e((()=>{pr=e=>{switch(e){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return e}},mr=e=>{switch(e){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return e}}})),gr,_r,vr=e((()=>{ur(),fr(),hr(),gr=class{detect(e){return{attributes:{[sr]:We(),[ar]:pr(Ue()),[or]:dr()}}}},_r=new gr})),yr,br,xr=e((()=>{ur(),hr(),yr=class{detect(e){return{attributes:{[cr]:mr(Ge()),[lr]:Ke()}}}},br=new yr})),Sr=e((()=>{vr(),xr(),ur()})),Cr=e((()=>{Sr()})),wr=e((()=>{ir(),Cr()})),Tr=e((()=>{tr(),wr(),qn()}));function Er(e){return Dr(e,new WeakSet)}function Dr(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Dr(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Dr(e,t))}return!1}var Or=e((()=>{})),kr,Ar=e((()=>{f(),b(),x(),Or(),a(),kr=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){o(this,`hrTime`,void 0),o(this,`hrTimeObserved`,void 0),o(this,`spanContext`,void 0),o(this,`resource`,void 0),o(this,`instrumentationScope`,void 0),o(this,`attributes`,{}),o(this,`_severityText`,void 0),o(this,`_severityNumber`,void 0),o(this,`_body`,void 0),o(this,`_eventName`,void 0),o(this,`_attributesCount`,0),o(this,`_droppedAttributesCount`,0),o(this,`_isReadonly`,!1),o(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:s,severityText:c,body:l,attributes:d={},exception:f,context:p}=n,h=Date.now();if(this.hrTime=ne(r??h),this.hrTimeObserved=ne(i??h),p){let e=u.getSpanContext(p);e&&m(e)&&(this.spanContext=e)}this.severityNumber=s,this.severityText=c,this.body=l,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(d),f!=null&&this._setException(f)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return p.warn(`Invalid attribute key: ${e}`),this;if(!Er(t))return p.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&p.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return p.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(de,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(h,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(h,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(de,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(ee,n.stack),t=!0)}t||p.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&p.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}})),jr,Mr=e((()=>{pe(),f(),Ar(),a(),jr=class{constructor(e,t){o(this,`instrumentationScope`,void 0),o(this,`_sharedState`,void 0),o(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||d.active(),r=e.severityNumber??S.UNSPECIFIED;if(r!==S.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=u.getSpanContext(n);if(e&&m(e)&&(e.traceFlags&l.SAMPLED)!==l.SAMPLED)return}let i=new kr(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==S.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||d.active();if(t.traceBased){let e=u.getSpanContext(r);if(e&&m(e)&&(e.traceFlags&l.SAMPLED)!==l.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}}})),Nr,Pr=e((()=>{Nr=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}})),Fr,Ir=e((()=>{b(),a(),Fr=class{constructor(e,t){o(this,`processors`,void 0),o(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>ae(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}));function Lr(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var Rr=e((()=>{})),zr,Br=e((()=>{zr=`otel.sdk.log.created`})),Vr,Hr=e((()=>{Br(),a(),Vr=class{constructor(e){o(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(zr,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}})),Ur,Wr=e((()=>{Ur=`0.215.0`})),Gr,Kr,qr,Jr=e((()=>{f(),pe(),Pr(),Ir(),Rr(),Hr(),Wr(),a(),Gr={disabled:!1,minimumSeverity:S.UNSPECIFIED,traceBased:!1},Kr=()=>({...Gr}),qr=class{constructor(e,t,n,r,i,a){o(this,`loggers`,new Map),o(this,`activeProcessor`,void 0),o(this,`registeredLogRecordProcessors`,[]),o(this,`resource`,void 0),o(this,`forceFlushTimeoutMillis`,void 0),o(this,`logRecordLimits`,void 0),o(this,`processors`,void 0),o(this,`loggerMetrics`,void 0),o(this,`_loggerConfigurator`,void 0),o(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new Fr(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Nr,this._loggerConfigurator=i??Kr;let c=a?a.getMeter(`@opentelemetry/sdk-logs`,Ur):s();this.loggerMetrics=new Vr(c)}getLoggerConfig(e){let t=Lr(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}})),Yr,Xr=e((()=>{f(),pe(),le(),b(),Mr(),Jr(),a(),Yr=class{constructor(e={}){o(this,`_shutdownOnce`,void 0),o(this,`_sharedState`,void 0);let t={resource:e.resource??oe(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??Kr,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new qr(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new ce(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return p.warn(`A shutdown LoggerProvider cannot provide a Logger`),fe;e||p.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new jr({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(p.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(p.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}})),Zr,Qr=e((()=>{b(),Zr=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:se(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:re.SUCCESS})}}}));async function $r(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var ei,ti,ni=e((()=>{f(),b(),a(),ei=class{constructor(e,t,n){o(this,`_exportCompleted`,void 0),o(this,`_exportScheduledPromise`,void 0),o(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await $r(t),await d.with(te(d.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){v(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===re.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},ti=class{constructor(e,t){o(this,`_maxExportBatchSize`,void 0),o(this,`_maxQueueSize`,void 0),o(this,`_scheduledDelayMillis`,void 0),o(this,`_exportTimeoutMillis`,void 0),o(this,`_exporter`,void 0),o(this,`_currentExport`,null),o(this,`_finishedLogRecords`,[]),o(this,`_timer`,void 0),o(this,`_shutdownOnce`,void 0),o(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new ce(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(p.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new ei(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){v(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new ei(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,v(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),ri,ii=e((()=>{ni(),ri=class extends ti{onShutdown(){}}})),ai=e((()=>{ii()})),oi=e((()=>{ai()})),si=e((()=>{Xr(),Qr(),oi()}));export{xt as $,pn as A,Zt as B,Mn as C,un as D,gn as E,cn as F,Bt as G,Kt as H,L as I,vt as J,Rt as K,en as L,hn as M,mn as N,dn as O,R as P,A as Q,F as R,Rn as S,bn as T,Ut as U,$t as V,Vt as W,bt as X,yt as Y,wt as Z,Yn as _,Qr as a,ft as at,Vn as b,Tr as c,pt as ct,_r as d,rt as dt,It as et,vr as f,at as ft,tr as g,Xn as h,Zr as i,Tt as it,yn as j,fn as k,xr as l,lt,ir as m,ri as n,_t as nt,Yr as o,D as ot,rr as p,Lt as q,ii as r,mt as rt,Xr as s,dt as st,si as t,ht as tt,br as u,E as ut,X as v,B as w,Hn as x,Gn as y,tn as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{FT as t,PT as n,Qd as r,St as i,Tt as a,Xd as o,vc as s,yc as c}from"./loadAgentsDir-BXtV2jiO.js";import{fi as l}from"./src-P_wYS_NJ2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{n as d,t as f}from"./ExitFlow-BFeftDv0.js";import{spawnSync as p}from"child_process";function m(){return t(_)??`Goodbye!`}async function h(e){if(c())return e(),p(`tmux`,[`detach-client`],{stdio:`ignore`}),null;let t=i()!==null;return t?(0,g.jsx)(f,{showWorktree:t,onDone:e,onCancel:()=>e()}):(e(m()),await o(0,`prompt_input_exit`),null)}var g,_;e((()=>{n(),l(),d(),s(),r(),a(),g=u(),_=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}))();export{h as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ic as e,Lc as t,Rc as n,zc as r}from"./loadAgentsDir-BXtV2jiO.js";r();export{e as drainPendingExtraction,t as executeExtractMemories,n as initExtractMemories};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./fast-VOu2FUlV.js";t();export{n as FastModePicker,e as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{AC as n,lg as r,og as i,sg as a}from"./loadAgentsDir-BXtV2jiO.js";import{Gt as o,I as s,Lt as c,P as l,di as u,fi as d,j as f,t as p,ui as m,y as h}from"./src-P_wYS_NJ2.js";import{t as g}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as _,g as v,x as y}from"./settings-DiBMs2gM.js";import{c as b,h as x}from"./config-9rLTDOYW.js";import{n as S,r as C}from"./analytics-DJobLaWP.js";import{l as w,v as T}from"./startupProfiler-Dc5r6LgE.js";import{G as E,H as D,J as O,K as k,U as A,W as j,X as M,et as N,it as P,lt as F,q as I,rt as L}from"./model-CDnVaVDR.js";import{n as R,t as z}from"./systemTheme-Ceakddth.js";function B({cooldown:e}){return e?(0,H.jsx)(l,{color:`promptBorder`,dimColor:!0,children:`↯`}):(0,H.jsx)(l,{color:`fastMode`,children:`↯`})}function V(e=!0,t=!1){if(!e)return`↯`;let n=R(b().theme);return t?m.dim(f(`promptBorder`,n)(`↯`)):f(`fastMode`,n)(`↯`)}var H,U=e((()=>{u(),d(),_(),p(),x(),z(),H=g()}));function W(e,t){k(),y(`userSettings`,{fastMode:e?!0:void 0}),t(e?e=>{let t=!P(e.mainLoopModel);return{...e,...t?{mainLoopModel:I(),mainLoopModelForSession:null}:{},fastMode:!0}}:e=>({...e,fastMode:!1}))}function G({onDone:e,unavailableReason:t}){let n=a(e=>e.mainLoopModel),i=a(e=>e.fastMode),u=r(),[d,f]=(0,J.useState)(i??!1),p=O(),m=p.status===`cooldown`,g=t!==null,_=D(A(!0));function v(){g||(W(d,u),C(`tengu_fast_mode_toggled`,{enabled:d,source:`picker`}),d?e(`${V(d)} Fast mode ON${P(n)?``:` · model set to ${E}`} · ${_}`):(u(e=>({...e,fastMode:!1})),e(`Fast mode OFF`)))}function y(){if(g){i&&W(!1,u),e(`Fast mode OFF`,{display:`system`});return}e(i?`${V()} Kept Fast mode ON`:`Kept Fast mode OFF`,{display:`system`})}function b(){g||f(e=>!e)}return o({"confirm:yes":v,"confirm:nextField":b,"confirm:next":b,"confirm:previous":b,"confirm:cycleMode":b,"confirm:toggle":b},{context:`Confirmation`}),(0,Y.jsxs)(h,{title:(0,Y.jsxs)(l,{children:[(0,Y.jsx)(B,{cooldown:m}),` Fast mode (research preview)`]}),subtitle:`High-speed mode for ${E}. Billed as extra usage at a premium rate. Separate rate limits apply.`,onCancel:y,color:`fastMode`,inputGuide:e=>e.pending?(0,Y.jsxs)(l,{children:[`Press `,e.keyName,` again to exit`]}):g?(0,Y.jsx)(l,{children:`Esc to cancel`}):(0,Y.jsx)(l,{children:`Tab to toggle · Enter to confirm · Esc to cancel`}),children:[t?(0,Y.jsx)(s,{marginLeft:2,children:(0,Y.jsx)(l,{color:`error`,children:t})}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(s,{flexDirection:`column`,gap:0,marginLeft:2,children:(0,Y.jsxs)(s,{flexDirection:`row`,gap:2,children:[(0,Y.jsx)(l,{bold:!0,children:`Fast mode`}),(0,Y.jsx)(l,{color:d?`fastMode`:void 0,bold:d,children:d?`ON `:`OFF`}),(0,Y.jsx)(l,{dimColor:!0,children:_})]})}),m&&p.status===`cooldown`&&(0,Y.jsx)(s,{marginLeft:2,children:(0,Y.jsxs)(l,{color:`warning`,children:[p.reason===`overloaded`?`Fast mode overloaded and is temporarily unavailable`:`You've hit your fast limit`,` · resets in `,w(p.resetAt-Date.now(),{hideTrailingZeros:!0})]})})]}),(0,Y.jsxs)(l,{dimColor:!0,children:[`Learn more:`,` `,(0,Y.jsx)(c,{url:`https://code.workmate.com/docs/en/fast-mode`,children:`https://code.workmate.com/docs/en/fast-mode`})]})]})}async function K(e,t,n){let r=M();if(r)return`Fast mode unavailable: ${r}`;let{mainLoopModel:i}=t();return W(e,n),C(`tengu_fast_mode_toggled`,{enabled:e,source:`shortcut`}),e?`${V(!0)} Fast mode ON${P(i)?``:` · model set to ${E}`} · ${D(A(!0))}`:`Fast mode OFF`}async function q(e,t,n){if(!L())return null;await F();let r=n?.trim().toLowerCase();if(r===`on`||r===`off`)return e(await K(r===`on`,t.getAppState,t.setAppState)),null;let i=M();return C(`tengu_fast_mode_picker_shown`,{unavailable_reason:i??``}),(0,Y.jsx)(G,{onDone:e,unavailableReason:i})}var J,Y,X=e((()=>{d(),J=t(d(),1),p(),U(),n(),S(),i(),N(),T(),j(),v(),Y=g()}));export{U as a,V as i,q as n,X as r,G as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./firstPartyEventLogger-aFhcruXA.js";e();export{t as initialize1PEventLogging};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{A as n,C as r,m as i,w as a}from"./external-CEp-aPkt.js";import{n as o,r as s,t as c}from"./lazySchema-B4D4qJVE.js";import{P as l,R as u,c as d,i as f}from"./debug-Dr1SjdXn.js";import{A as p,dt as m,ft as h,j as g}from"./sessionState-DSWN4tMV.js";import"./bridgeMessaging-C9D0Lly2.js";import{i as _}from"./workSecret-XLodD7tw.js";import{t as v}from"./ccrClient-BG9HU_fW.js";import{n as y,t as b}from"./SSETransport-je346ofV.js";s(),c(),m();var x={init_retry_max_attempts:3,init_retry_base_delay_ms:500,init_retry_jitter_fraction:.25,init_retry_max_delay_ms:4e3,http_timeout_ms:1e4,uuid_dedup_buffer_size:2e3,heartbeat_interval_ms:2e4,heartbeat_jitter_fraction:.1,token_refresh_buffer_ms:3e5,teardown_archive_timeout_ms:1500,connect_timeout_ms:15e3,min_version:`0.0.0`,should_show_app_upgrade_message:!1},S=o(()=>a({init_retry_max_attempts:r().int().min(1).max(10).default(3),init_retry_base_delay_ms:r().int().min(100).default(500),init_retry_jitter_fraction:r().min(0).max(1).default(.25),init_retry_max_delay_ms:r().int().min(500).default(4e3),http_timeout_ms:r().int().min(2e3).default(1e4),uuid_dedup_buffer_size:r().int().min(100).max(5e4).default(2e3),heartbeat_interval_ms:r().int().min(5e3).max(3e4).default(2e4),heartbeat_jitter_fraction:r().min(0).max(.5).default(.1),token_refresh_buffer_ms:r().int().min(3e4).max(18e5).default(3e5),teardown_archive_timeout_ms:r().int().min(500).max(2e3).default(1500),connect_timeout_ms:r().int().min(5e3).max(6e4).default(15e3),min_version:n().refine(e=>{try{return h(e,`0.0.0`),!0}catch{return!1}}).default(`0.0.0`),should_show_app_upgrade_message:i().default(!1)}));async function C(){let e=x,t=S().safeParse(e);return t.success?t.data:x}async function w(){let e=await C();return e.min_version&&h(`0.0.12`,e.min_version)?`Your version of Work Mate (0.0.12) is too old for Remote Control.\nVersion ${e.min_version} or higher is required. Run \`claude update\` to update.`:null}y(),f(),u(),p();function T(e){return{write:t=>e.write(t),writeBatch:t=>e.writeBatch(t),close:()=>e.close(),isConnectedStatus:()=>e.isConnectedStatus(),getStateLabel:()=>e.getStateLabel(),setOnData:t=>e.setOnData(t),setOnClose:t=>e.setOnClose(t),setOnConnect:t=>e.setOnConnect(t),connect:()=>void e.connect(),getLastSequenceNum:()=>0,get droppedBatchCount(){return e.droppedBatchCount},reportState:()=>{},reportMetadata:()=>{},reportDelivery:()=>{},flush:()=>Promise.resolve()}}async function E(e){let{sessionUrl:t,ingressToken:n,sessionId:r,initialSequenceNum:i,getAuthToken:a}=e,o;a?o=()=>{let e=a();return e?{Authorization:`Bearer ${e}`}:{}}:g(n);let s=e.epoch??await _(t,n);d(`[bridge:repl] CCR v2: worker sessionId=${r} epoch=${s}${e.epoch===void 0?` (via registerWorker)`:` (from /bridge)`}`);let c=new URL(t);c.pathname=c.pathname.replace(/\/$/,``)+`/worker/events/stream`;let u=new b(c,{},r,void 0,i,o),f,p=new v(u,new URL(t),{getAuthHeaders:o,heartbeatIntervalMs:e.heartbeatIntervalMs,heartbeatJitterFraction:e.heartbeatJitterFraction,onEpochMismatch:()=>{d(`[bridge:repl] CCR v2: epoch superseded (409) — closing for poll-loop recovery`);try{p.close(),u.close(),f?.(4090)}catch(e){d(`[bridge:repl] CCR v2: error during epoch-mismatch cleanup: ${l(e)}`,{level:`error`})}throw Error(`epoch superseded`)}});u.setOnEvent(e=>{p.reportDelivery(e.event_id,`received`),p.reportDelivery(e.event_id,`processed`)});let m,h=!1,y=!1;return{write(e){return p.writeEvent(e)},async writeBatch(e){for(let t of e){if(y)break;await p.writeEvent(t)}},close(){y=!0,p.close(),u.close()},isConnectedStatus(){return h},getStateLabel(){return u.isClosedStatus()?`closed`:u.isConnectedStatus()?h?`connected`:`init`:`connecting`},setOnData(e){u.setOnData(e)},setOnClose(e){f=e,u.setOnClose(t=>{p.close(),e(t??4092)})},setOnConnect(e){m=e},getLastSequenceNum(){return u.getLastSequenceNum()},droppedBatchCount:0,reportState(e){p.reportState(e)},reportMetadata(e){p.reportMetadata(e)},reportDelivery(e,t){p.reportDelivery(e,t)},flush(){return p.flush()},connect(){e.outboundOnly||u.connect(),p.initialize(s).then(()=>{h=!0,d(`[bridge:repl] v2 transport ready for writes (epoch=${s}, sse=${u.isConnectedStatus()?`open`:`opening`})`),m?.()},e=>{d(`[bridge:repl] CCR v2 initialize failed: ${l(e)}`,{level:`error`}),p.close(),u.close(),f?.(4091)})}}}e();var D=class{constructor(){t(this,`_active`,!1),t(this,`_pending`,[])}get active(){return this._active}get pendingCount(){return this._pending.length}start(){this._active=!0}end(){return this._active=!1,this._pending.splice(0)}enqueue(...e){return this._active?(this._pending.push(...e),!0):!1}drop(){this._active=!1;let e=this._pending.length;return this._pending.length=0,e}deactivate(){this._active=!1}};export{C as a,w as i,T as n,E as r,D as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ba as t,Ya as n,ga as r,it as i,qa as a,st as o}from"./loadAgentsDir-BXtV2jiO.js";import{P as s,R as c,c as l,i as u}from"./debug-Dr1SjdXn.js";import{a as d,l as f}from"./proxy-BEKNaTXI.js";import{K as p,M as m,W as h,Y as g,Z as _,et as v,q as y}from"./sessionState-DSWN4tMV.js";import{n as b,r as x}from"./SSETransport-je346ofV.js";import{randomUUID as S}from"crypto";function C(){return(process.env.GEMINI_BASE_URL||E).replace(/\/+$/,``)}function w(e){let t=e.replace(/^\/+/,``);return t.startsWith(`models/`)?t:`models/${t}`}async function*T(e){let t=await(e.fetchOverride??fetch)(`${C()}/${w(e.model)}:streamGenerateContent?alt=sse`,{method:`POST`,headers:{"Content-Type":`application/json`,"x-goog-api-key":process.env.GEMINI_API_KEY||``},body:JSON.stringify(e.body),signal:e.signal,...d({forAnthropicAPI:!1})});if(!t.ok){let e=await t.text();throw Error(`Gemini API request failed (${t.status} ${t.statusText}): ${e||`empty response body`}`)}if(!t.body)throw Error(`Gemini API returned no response body`);let n=t.body.getReader(),r=new TextDecoder,i=``;try{for(;;){let{done:e,value:t}=await n.read();if(e)break;i+=r.decode(t,D);let{frames:a,remaining:o}=x(i);i=o;for(let e of a)if(!(!e.data||e.data===`[DONE]`))try{yield JSON.parse(e.data)}catch(e){throw Error(`Failed to parse Gemini SSE payload: ${s(e)}`)}}i+=r.decode();let{frames:e}=x(i);for(let t of e)if(!(!t.data||t.data===`[DONE]`))try{yield JSON.parse(t.data)}catch(e){throw Error(`Failed to parse trailing Gemini SSE payload: ${s(e)}`)}}finally{n.releaseLock()}}var E,D,O=e((()=>{b(),c(),f(),E=`https://generativelanguage.googleapis.com/v1beta`,D={stream:!0}}));async function*k(e,t,i,s,c,u){try{let r=v(c.model),d=n(e,i),f=(await Promise.all(i.map(e=>o(e,{getToolPermissionContext:c.getToolPermissionContext,tools:i,agents:c.agents,allowedAgentTypes:c.allowedAgentTypes,model:c.model})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),{contents:m,systemInstruction:b}=g(d,t),x=y(f),C=p(c.toolChoice),w=T({model:r,signal:s,fetchOverride:c.fetchOverride,body:{contents:m,...b&&{systemInstruction:b},...x.length>0&&{tools:x},...C&&{toolConfig:{functionCallingConfig:C}},generationConfig:{...c.temperatureOverride!==void 0&&{temperature:c.temperatureOverride},...u.type!==`disabled`&&{thinkingConfig:{includeThoughts:!0,...u.type===`enabled`&&{thinkingBudget:u.budgetTokens}}}}}});l(`[Gemini] Calling model=${r}, messages=${m.length}, tools=${x.length}`);let E=h(w,r),D={},O=null,k=0,A=Date.now();for await(let e of E){switch(e.type){case`message_start`:O=e.message,k=Date.now()-A;break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?D[t]={...n,input:``}:n.type===`text`?D[t]={...n,text:``}:n.type===`thinking`?D[t]={...n,thinking:``,signature:``}:D[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=D[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.type===`thinking`?r.signature=n.signature:r[_]=n.signature);break}case`content_block_stop`:{let t=D[e.index];if(!t||!O)break;yield{message:{...O,content:a([t],i,c.agentId)},requestId:void 0,type:`assistant`,uuid:S(),timestamp:new Date().toISOString()};break}case`message_delta`:case`message_stop`:break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:k}:void 0}}}catch(e){let t=e instanceof Error?e.message:String(e);l(`[Gemini] Error: ${t}`,{level:`error`}),yield r({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{i(),u(),t(),O(),m()}))();export{k as queryModelGemini};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$ as t,Ba as n,Oa as r,et as i,nv as a}from"./loadAgentsDir-BXtV2jiO.js";import{P as o,R as s,c,i as l}from"./debug-Dr1SjdXn.js";import{s as u,u as d}from"./types-BJ7qTz75.js";import{at as f}from"./sessionState-DSWN4tMV.js";import{r as p,t as m}from"./sessionTitle-L5tyJgdU.js";async function h(e,t){let n=m(e);if(!n)return null;try{let e=await i({systemPrompt:f([`Generate a short kebab-case name (2-4 words) that captures the main topic of this conversation. Use lowercase words separated by hyphens. Examples: "fix-login-bug", "add-auth-feature", "refactor-api-client", "debug-test-failures". Return JSON with a "name" field.`]),userPrompt:n,outputFormat:{type:`json_schema`,schema:{type:`object`,properties:{name:{type:`string`}},required:[`name`],additionalProperties:!1}},signal:t,options:{querySource:`rename_generate_name`,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,mcpTools:[]}}),a=d(Array.isArray(e.message.content)?r(e.message.content):e.message.content);return a&&typeof a==`object`&&`name`in a&&typeof a.name==`string`?a.name:null}catch(e){return c(`generateSessionName failed: ${o(e)}`,{level:`error`}),null}}var g=e((()=>{t(),l(),s(),u(),n(),p(),a()}));export{g as n,h as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t,m as n,r,u as i}from"./git-CoQQ6YEf.js";n();export{r as findGitRoot,t as getBranch,e as getDefaultBranch,i as getRemoteUrl};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{By as t,Gy as n,Hy as r,Jy as i,Ky as a,Ry as o,Uy as s,Vy as c,Xu as l,Xy as u,Yy as d,Zu as f,_l as p,my as m,vl as h,yl as g,yy as _,zy as v}from"./loadAgentsDir-BXtV2jiO.js";import{I as y,P as b,fi as x,t as S}from"./src-P_wYS_NJ2.js";import{t as C}from"./jsx-runtime-Bb4Xn-E0.js";import{n as w,t as T}from"./PermissionDialog-Cb3z8OUP.js";function E({currentGoal:e,newObjective:t,onConfirm:n,onCancel:i}){function a(e){e===`yes`?n():i()}let o=e.tokenBudget===null?`${e.tokensUsed}`:`${e.tokensUsed} / ${e.tokenBudget}`;return(0,D.jsx)(T,{color:`warning`,title:`Replace active goal?`,children:(0,D.jsxs)(y,{flexDirection:`column`,marginTop:1,paddingX:1,children:[(0,D.jsx)(b,{children:`A goal is already in progress. Replacing it will reset all progress and counters.`}),(0,D.jsxs)(y,{marginTop:1,flexDirection:`column`,children:[(0,D.jsx)(b,{dimColor:!0,children:`Current goal:`}),(0,D.jsxs)(b,{children:[(0,D.jsx)(b,{dimColor:!0,children:`· Objective: `}),e.objective]}),(0,D.jsxs)(b,{children:[(0,D.jsx)(b,{dimColor:!0,children:`· Status: `}),r(e.status)]}),(0,D.jsxs)(b,{children:[(0,D.jsx)(b,{dimColor:!0,children:`· Time: `}),c(e)]}),(0,D.jsxs)(b,{children:[(0,D.jsx)(b,{dimColor:!0,children:`· Tokens: `}),o]})]}),(0,D.jsxs)(y,{marginTop:1,flexDirection:`column`,children:[(0,D.jsx)(b,{dimColor:!0,children:`New objective:`}),(0,D.jsx)(b,{children:t})]}),(0,D.jsx)(y,{marginTop:1,children:(0,D.jsx)(f,{options:[{label:`Yes, replace the goal`,value:`yes`},{label:`No, keep the current goal`,value:`no`}],onChange:a,onCancel:i})})]})})}var D,O=e((()=>{x(),S(),l(),w(),a(),D=C()}));function k(e){let t=e.split(`
|
|
2
|
-
`)[0]??e;return t.length<=I?t:t.slice(0,I)+`…`}function A(){_(e=>e.origin===`goal-continuation`||e.origin===`goal-budget-limit`)}function j(){let e=s();if(!e)return"No active goal. Set one with `/goal <objective>`.";let t=e.tokenBudget===null?`${e.tokensUsed}`:`${e.tokensUsed} / ${e.tokenBudget}`,n=[`Goal: ${e.objective}`,`Status: ${r(e.status)}`,`Time: ${c(e)}`,`Tokens: ${t}`,`Continuation turns: ${e.turnsExecuted}`];return e.status===`max_turns`&&n.push("Hint: Max continuation turns reached (150). Run `/goal continue` to reset and continue."),n.join(`
|
|
3
|
-
`)}function M(e){return u(e),n(),h(),`Goal set.`}async function N(e,n,r){let a=r.trim();if(!a||a.toLowerCase()===`status`)return e(j(),{display:`system`}),null;let c=a.toLowerCase();if(c===`clear`){let t=o();return t&&(g(),A()),e(t?`Goal cleared.`:`No active goal to clear.`,{display:`system`}),null}if(c===`pause`){let t=i();return t&&(h(),A()),e(t?`Goal paused.`:`No active goal to pause.`,{display:`system`}),null}if(c===`resume`){if(s()?.status===`max_turns`)return e("Goal reached max continuation turns (150). Run `/goal continue` to reset turn counter and continue.",{display:`system`}),null;let t=d();return t&&h(),e(t?`Goal resumed.`:`No paused goal to resume.`,{display:`system`,shouldQuery:!!t}),null}if(c===`continue`){let n=t();return n&&h(),e(n?`Goal continuation counter reset (0/150). Continuing...`:`Current goal is not in max-turns state.`,{display:`system`,shouldQuery:!!n}),null}if(c===`complete`){let t=v();return t&&(h(),A()),e(t?`Goal marked complete.`:`No active goal to complete.`,{display:`system`}),null}if(a.length>F)return e(`Goal objective is too long (${a.length} chars; limit ${F}). Save the detailed instructions to a file and reference it from a shorter objective.`,{display:`system`}),null;let l=s();return l&&l.status!==`complete`?(0,P.jsx)(E,{currentGoal:l,newObjective:a,onConfirm:()=>{A(),e(M(a),{display:`system`,shouldQuery:!0,displayArgs:k(a),metaMessages:[`<goal-objective-updated>\n${a}\n</goal-objective-updated>`]})},onCancel:()=>{e(`Kept the current goal. New objective discarded.`,{display:`system`})}}):(e(M(a),{display:`system`,shouldQuery:!0,displayArgs:k(a),metaMessages:[`<goal-objective-updated>\n${a}\n</goal-objective-updated>`]}),null)}var P,F,I;e((()=>{x(),a(),p(),m(),O(),P=C(),F=4e3,I=80}))();export{N as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ba as t,Fy as n,Ya as r,dT as i,fT as a,ga as o,it as s,jy as c,qa as l,st as u}from"./loadAgentsDir-BXtV2jiO.js";import{c as d,i as f}from"./debug-Dr1SjdXn.js";import{V as p,W as m}from"./model-CDnVaVDR.js";import{F as h,I as g,M as _,N as v,R as y,nt as b}from"./sessionState-DSWN4tMV.js";import{n as x,t as S}from"./openaiShared-G2-w4gJt.js";import{randomUUID as C}from"crypto";async function*w(e,t,n,a,s){try{let o=b(s.model),f=r(e,n),m=(await Promise.all(n.map(e=>u(e,{getToolPermissionContext:s.getToolPermissionContext,tools:n,agents:s.agents,allowedAgentTypes:s.allowedAgentTypes,model:s.model})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),_=y(f,t),S=g(m),w=h(s.toolChoice),T=i({maxRetries:0,fetchOverride:s.fetchOverride,source:s.querySource});d(`[Grok] Calling model=${o}, messages=${_.length}, tools=${S.length}`);let E=v(await T.chat.completions.create({model:o,messages:_,...S.length>0&&{tools:S,...w&&{tool_choice:w}},stream:!0,stream_options:{include_usage:!0},...s.temperatureOverride!==void 0&&{temperature:s.temperatureOverride}},{signal:a}),o),D={},O=null,k={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},A=0,j=Date.now();for await(let e of E){switch(e.type){case`message_start`:O=e.message,A=Date.now()-j,e.message.usage&&(k=x(k,e.message.usage));break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?D[t]={...n,input:``}:n.type===`text`?D[t]={...n,text:``}:n.type===`thinking`?D[t]={...n,thinking:``,signature:``}:D[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=D[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:{let t=D[e.index];if(!t||!O)break;yield{message:{...O,content:l([t],n,s.agentId)},requestId:void 0,type:`assistant`,uuid:C(),timestamp:new Date().toISOString()};break}case`message_delta`:{let t=e.usage;t&&(k=x(k,t));break}case`message_stop`:break}e.type===`message_stop`&&k.input_tokens+k.output_tokens>0&&c(p(o,k),k,s.model),yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:A}:void 0}}}catch(e){let t=e instanceof Error?e.message:String(e);d(`[Grok] Error: ${t}`,{level:`error`}),yield o({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{a(),S(),_(),t(),s(),f(),n(),m()}))();export{w as queryModelGrok};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{AC as n,Bi as r,IC as i,MC as a,Ni as o,Oi as s,Qu as c,Zu as l,jC as u}from"./loadAgentsDir-BXtV2jiO.js";import{I as d,Lt as f,P as p,Wt as m,a as h,fi as g,n as _,ot as v,r as y,t as b,x}from"./src-P_wYS_NJ2.js";import{t as S}from"./jsx-runtime-Bb4Xn-E0.js";import{b as C,y as w}from"./startupProfiler-Dc5r6LgE.js";import{n as T,t as E}from"./useExitOnCtrlCDWithKeybindings-BHQfwlAl.js";import{n as D,r as O}from"./modalContext-CUThy6Ph.js";import{n as k,t as A}from"./PromptInputHelpMenu-BP3UgCdi.js";function j({commands:e,maxHeight:t,columns:n,title:r,onCancel:i,emptyMessage:a}){let{headerFocused:s,focusHeader:c}=h(),u=Math.max(1,n-10),f=Math.max(1,Math.floor((t-10)/2)),m=(0,M.useMemo)(()=>{let t=new Set;return e.filter(e=>t.has(e.name)?!1:(t.add(e.name),!0)).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({label:`/${e.name}`,value:e.name,description:C(o(e),u,!0)}))},[e,u]);return(0,N.jsx)(d,{flexDirection:`column`,paddingY:1,children:e.length===0&&a?(0,N.jsx)(p,{dimColor:!0,children:a}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(p,{children:r}),(0,N.jsx)(d,{marginTop:1,children:(0,N.jsx)(l,{options:m,visibleOptionCount:f,onCancel:i,disableSelection:!0,hideIndexes:!0,layout:`compact-vertical`,onUpFromFirstItem:c,isDisabled:s})})]})})}var M,N,P=e((()=>{g(),M=t(g(),1),r(),w(),b(),c(),N=S()}));function F(){return(0,I.jsxs)(d,{flexDirection:`column`,paddingY:1,gap:1,children:[(0,I.jsxs)(d,{flexDirection:`column`,gap:1,children:[(0,I.jsx)(p,{bold:!0,children:`Getting started`}),(0,I.jsxs)(d,{flexDirection:`column`,children:[(0,I.jsxs)(p,{children:[(0,I.jsx)(p,{bold:!0,children:`1. `}),(0,I.jsx)(p,{children:`Ask a question or describe a task — Claude will explore your code and respond.`})]}),(0,I.jsxs)(p,{children:[(0,I.jsx)(p,{bold:!0,children:`2. `}),(0,I.jsx)(p,{children:`When Claude wants to edit files or run commands, you review and approve each action.`})]}),(0,I.jsxs)(p,{children:[(0,I.jsx)(p,{bold:!0,children:`3. `}),(0,I.jsx)(p,{children:`Type `}),(0,I.jsx)(p,{bold:!0,children:`/help`}),(0,I.jsx)(p,{children:` for commands, or `}),(0,I.jsx)(p,{bold:!0,children:`?`}),(0,I.jsx)(p,{children:` for shortcuts.`})]})]})]}),(0,I.jsxs)(d,{flexDirection:`column`,children:[(0,I.jsx)(d,{children:(0,I.jsx)(p,{bold:!0,children:`Shortcuts`})}),(0,I.jsx)(A,{gap:2,fixedWidth:!0})]})]})}var I,L=e((()=>{g(),b(),k(),I=S()}));function R({onClose:e,commands:t}){let{rows:n,columns:r}=v(),i=Math.floor(n/2),o=O(),c=()=>e(`Help dialog dismissed`,{display:`system`});m(`help:dismiss`,c,{context:`Help`});let l=T(c),u=a(`help:dismiss`,`Help`,`esc`),h=s(),g=t.filter(e=>h.has(e.name)&&!e.isHidden),b=t.filter(e=>!h.has(e.name)&&!e.isHidden),S=[(0,z.jsx)(_,{title:`general`,children:(0,z.jsx)(F,{})},`general`)];return S.push((0,z.jsx)(_,{title:`commands`,children:(0,z.jsx)(j,{commands:g,maxHeight:i,columns:r,title:`Browse default commands:`,onCancel:c})},`commands`)),S.push((0,z.jsx)(_,{title:`custom-commands`,children:(0,z.jsx)(j,{commands:b,maxHeight:i,columns:r,title:`Browse custom commands:`,emptyMessage:`No custom commands found`,onCancel:c})},`custom`)),(0,z.jsx)(d,{flexDirection:`column`,height:o?void 0:i,children:(0,z.jsxs)(x,{color:`professionalBlue`,children:[(0,z.jsx)(y,{title:`Work Mate v0.0.12`,color:`professionalBlue`,defaultTab:`general`,children:S}),(0,z.jsx)(d,{marginTop:1,children:(0,z.jsxs)(p,{children:[`For more help: `,(0,z.jsx)(f,{url:`https://code.workmate.com/docs/en/overview`})]})}),(0,z.jsx)(d,{marginTop:1,children:(0,z.jsx)(p,{dimColor:!0,children:l.pending?(0,z.jsxs)(z.Fragment,{children:[`Press `,l.keyName,` again to exit`]}):(0,z.jsxs)(p,{italic:!0,children:[u,` to cancel`]})})})]})})}var z,B=e((()=>{g(),E(),u(),r(),D(),i(),b(),n(),P(),L(),z=S()})),V,H;e((()=>{B(),V=S(),H=async(e,{options:{commands:t}})=>(0,V.jsx)(R,{commands:t,onClose:e})}))();export{H as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Xt as e,_n as t,un as n,vn as r}from"./loadAgentsDir-BXtV2jiO.js";r();export{e as executeSessionEndHooks,n as getSessionEndHookTimeoutMs,t as hasWorktreeCreateHook};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as e,o as t,u as n}from"./envUtils-DcaKZlRU.js";import{Aa as r,Ba as i,Cr as a,Ma as o,Sc as s,Wa as c,bE as l,lf as u,or as d,pf as f,sf as p,vc as m,yE as h}from"./loadAgentsDir-BXtV2jiO.js";import{Wt as g,et as _,pt as v}from"./state-BPFYBqm1.js";import{P as y,R as b,c as x,i as S,nt as ee,tt as C}from"./debug-Dr1SjdXn.js";import{c as te,h as ne,y as re}from"./config-9rLTDOYW.js";import{O as w,i as ie,k as T,m as E,u as D}from"./git-CoQQ6YEf.js";import{g as O,m as k}from"./log-27kCA_9u.js";import{n as A,r as j}from"./analytics-DJobLaWP.js";import{Bt as ae,Fr as M,It as N,Ot as oe,Pr as se,_n as P,mt as F,vn as I}from"./model-CDnVaVDR.js";import{A as L,c as ce,j as le,n as R}from"./sessionState-DSWN4tMV.js";import{a as ue,i as de,r as fe,t as z}from"./sessionIdCompat-DMayYBrf.js";import{a as B,i as pe,n as V,o as me,t as H}from"./bridgeConfig-BB6Hgali.js";import{a as U,o as W,r as G,s as K}from"./debugUtils-cK-iOsEV.js";import{a as q,i as J,n as he,t as Y}from"./createSession-CftIZ3aq.js";import{n as ge,o as X}from"./mappers-IuJeXgvr.js";import{n as _e,r as Z,t as Q}from"./sessionTitle-L5tyJgdU.js";import{a as ve,d as ye,f as be,i as xe,l as Se,n as Ce,o as we,r as Te,t as Ee,u as De}from"./bridgeMessaging-C9D0Lly2.js";import{i as Oe,n as ke,r as Ae,t as je}from"./flushGate-BUSrMj_6.js";import{n as Me,t as Ne}from"./pollConfig-BgpfHQPJ.js";import{n as Pe,t as Fe}from"./rcDebugLog-DSchf3Hs.js";import{a as Ie,i as Le,n as $,o as Re,r as ze,t as Be}from"./capacityWake-ByL6fM6I.js";import{a as Ve,n as He,r as Ue,t as We}from"./workSecret-XLodD7tw.js";import{i as Ge}from"./trustedDevice-Bzz03jCy.js";import{t as Ke}from"./HybridTransport-BadJQe6u.js";import{hostname as qe}from"os";import{randomUUID as Je}from"crypto";g(),k(),E(),ne(),M(),ae(),l(),p(),i(),a(),B(),J(),ge(),Z(),S(),Fe(),w(),A(),C(),z(),m(),L(),R(),t(),W(),b(),P();var Ye=2e3,Xe=6e4,Ze=900*1e3,Qe=0;async function $e(t){let{dir:r,machineName:i,branch:a,gitRepoUrl:o,title:c,baseUrl:l,sessionIngressUrl:u,workerType:d,getAccessToken:f,createSession:p,archiveSession:m,getCurrentTitle:h=()=>c,toSDKMessages:g=()=>{throw Error(`BridgeCoreParams.toSDKMessages not provided. Pass it if you use writeMessages() or initialMessages — daemon callers that only use writeSdkMessages() never hit this path.`)},onAuth401:_,getPollIntervalConfig:v=()=>Me,initialHistoryCap:b=200,initialMessages:S,previouslyFlushedUUIDs:C,onInboundMessage:te,onPermissionResponse:ne,onInterrupt:re,onSetModel:w,onSetMaxThinkingTokens:ie,onSetPermissionMode:E,onStateChange:D,onUserMessage:O,perpetual:k,initialSSESequenceNum:A=0}=t,ae=++Qe,{writeBridgePointer:M,clearBridgePointer:N,readBridgePointer:oe}=await import(`./bridgePointer-DHWK3LEe.js`),se=k?await oe(r):null,P=se?.source===`repl`?se:null;x(`[bridge:repl] initBridgeCore #${ae} starting (initialMessages=${S?.length??0}${P?` perpetual prior=env:${P.environmentId}`:``})`);let F=ze({baseUrl:l,getAccessToken:f,runnerVersion:`0.0.12`,onDebug:x,onAuth401:_,getTrustedDeviceToken:Ge}),I={dir:r,machineName:i,branch:a,gitRepoUrl:o,maxSessions:1,spawnMode:`single-session`,verbose:!1,sandbox:!1,bridgeId:Je(),workerType:d,environmentId:Je(),reuseEnvironmentId:P?.environmentId,apiBaseUrl:l,sessionIngressUrl:u},L,R;try{let e=await F.registerBridgeEnvironment(I);L=e.environment_id,R=e.environment_secret}catch(e){return K(`registration_failed`,`[bridge:repl] Environment registration failed: ${y(e)}`),P&&await N(r),D?.(`failed`,y(e)),null}x(`[bridge:repl] Environment registered: ${L}`),T(`info`,`bridge_repl_env_registered`),j(`tengu_bridge_repl_env_registered`,{});async function fe(e,t){if(L!==e)return x(`[bridge:repl] Env mismatch (requested ${e}, got ${L}) — cannot reconnect in place`),!1;let n=ue(t),r=n===t?[t]:[t,n];for(let e of r)try{return await F.reconnectSession(L,e),x(`[bridge:repl] Reconnected session ${e} in place on env ${L}`),!0}catch(t){x(`[bridge:repl] reconnectSession(${e}) failed: ${y(t)}`)}return x(`[bridge:repl] reconnectSession exhausted — falling through to fresh session`),!1}let z=P?await fe(P.environmentId,P.sessionId):!1;P&&!z&&await N(r);let B;if(z&&P){if(B=P.sessionId,x(`[bridge:repl] Perpetual session reused: ${B}`),S&&C)for(let e of S)C.add(e.uuid)}else{let e=await p({environmentId:L,title:c,gitRepoUrl:o,branch:a,signal:AbortSignal.timeout(15e3)});if(!e)return x(`[bridge:repl] Session creation failed, deregistering environment`),j(`tengu_bridge_repl_session_failed`,{}),await F.deregisterEnvironment(L).catch(()=>{}),D?.(`failed`,`Session creation failed`),null;B=e,x(`[bridge:repl] Session created: ${B}`)}await M(r,{sessionId:B,environmentId:L,source:`repl`}),T(`info`,`bridge_repl_session_created`),j(`tengu_bridge_repl_started`,{has_initial_messages:!!(S&&S.length>0),inProtectedNamespace:n()});let pe=new Set;if(S)for(let e of S)pe.add(e.uuid);let V=new Ee(2e3);for(let e of pe)V.add(e);let me=new Ee(2e3),H=new AbortController,U=null;ce(e=>{H.signal.aborted||U?.reportMetadata(e)},{replayCurrent:!0});let W=0,G=z?A:0,q=null,J=null,he=Be(H.signal),Y=he.wake,ge=he.signal,X=new je,_e=!O,Z=0,Q=null;async function ye(){if(Q)return Q;Q=be();try{return await Q}finally{Q=null}}async function be(){if(Z++,Pe(`doReconnect: attempt=${Z}/3 envId=${L} sessionId=${B} workId=${q}`),W++,x(`[bridge:repl] Reconnecting after env lost (attempt ${Z}/3)`),Z>3)return x(`[bridge:repl] Environment reconnect limit reached (3), giving up`),!1;if(U){let e=U.getLastSequenceNum();e>G&&(G=e),U.close(),U=null}if(Y(),X.drop(),q){let e=q;if(await F.stopWork(L,e,!1).catch(()=>{}),q!==e)return x(`[bridge:repl] Poll loop recovered during stopWork await — deferring to it`),Z=0,!0;q=null,J=null}if(H.signal.aborted)return x(`[bridge:repl] Reconnect aborted by teardown`),!1;let e=L;I.reuseEnvironmentId=e;try{let e=await F.registerBridgeEnvironment(I);L=e.environment_id,R=e.environment_secret}catch(e){return I.reuseEnvironmentId=void 0,x(`[bridge:repl] Environment re-registration failed: ${y(e)}`),!1}if(I.reuseEnvironmentId=void 0,x(`[bridge:repl] Re-registered: requested=${e} got=${L}`),H.signal.aborted)return x(`[bridge:repl] Reconnect aborted after env registration, cleaning up`),await F.deregisterEnvironment(L).catch(()=>{}),!1;if(U!==null)return x(`[bridge:repl] Poll loop recovered during registerBridgeEnvironment await — deferring to it`),Z=0,!0;if(await fe(e,B))return j(`tengu_bridge_repl_reconnected_in_place`,{}),Z=0,!0;if(L!==e&&j(`tengu_bridge_repl_env_expired_fresh_session`,{}),await m(B),H.signal.aborted)return x(`[bridge:repl] Reconnect aborted after archive, cleaning up`),await F.deregisterEnvironment(L).catch(()=>{}),!1;let t=h(),n=await p({environmentId:L,title:t,gitRepoUrl:o,branch:a,signal:AbortSignal.timeout(15e3)});return n?H.signal.aborted?(x(`[bridge:repl] Reconnect aborted after session creation, cleaning up`),await m(n),!1):(B=n,s(de(n)).catch(()=>{}),G=0,me.clear(),_e=!O,x(`[bridge:repl] Re-created session: ${B}`),await M(r,{sessionId:B,environmentId:L,source:`repl`}),C?.clear(),Z=0,!0):(x(`[bridge:repl] Session creation failed during reconnection`),!1)}function Se(){return f()}function De(){let e=X.end();if(e.length===0)return;if(!U){x(`[bridge:repl] Cannot drain ${e.length} pending message(s): no transport`);return}for(let t of e)V.add(t.uuid);let t=g(e).map(e=>({...e,session_id:B}));x(`[bridge:repl] Drained ${e.length} pending message(s) after flush`),U.writeBatch(t)}let Oe=null;function Ne(){Oe?.()}function Fe(e){if(Pe(`handleTransportPermanentClose: code=${e} transport=${U?`exists`:`null`} pollAborted=${H.signal.aborted}`),x(`[bridge:repl] Transport permanently closed: code=${e}`),j(`tengu_bridge_repl_ws_closed`,{code:e}),U){let e=U.getLastSequenceNum();e>G&&(G=e),U=null}Y();let t=X.drop();if(t>0&&x(`[bridge:repl] Dropping ${t} pending message(s) on transport close (code=${e})`,{level:`warn`}),e===1e3){D?.(`failed`,`session ended`),H.abort(),Ne();return}D?.(`reconnecting`,`Remote Control connection lost (code ${e})`),x(`[bridge:repl] Transport reconnect budget exhausted (code=${e}), attempting env reconnect`),ye().then(t=>{t||H.signal.aborted||(x(`[bridge:repl] reconnectEnvironmentWithSession resolved false — tearing down`),j(`tengu_bridge_repl_reconnect_failed`,{close_code:e}),D?.(`failed`,`reconnection failed`),Ne())})}et({api:F,getCredentials:()=>({environmentId:L,environmentSecret:R}),signal:H.signal,getPollIntervalConfig:v,onStateChange:D,getWsState:()=>U?.getStateLabel()??`null`,isAtCapacity:()=>U!==null,capacitySignal:ge,onFatalError:Ne,getHeartbeatInfo:()=>!q||!J?null:{environmentId:L,workId:q,sessionToken:J},onHeartbeatFatal:e=>{if(x(`[bridge:repl] heartbeatWork fatal (status=${e.status}) — tearing down work item for fast re-dispatch`),U){let e=U.getLastSequenceNum();e>G&&(G=e),U.close(),U=null}X.drop(),q&&F.stopWork(L,q,!1).catch(e=>{x(`[bridge:repl] stopWork after heartbeat fatal: ${y(e)}`)}),q=null,J=null,Y(),D?.(`reconnecting`,`Work item lease expired, fetching fresh token`)},async onEnvironmentLost(){return await ye()?{environmentId:L,environmentSecret:R}:null},onWorkReceived:(t,n,i,a)=>{if(U?.isConnectedStatus()&&x(`[bridge:repl] Work received while transport connected, replacing with fresh token (workId=${i})`),x(`[bridge:repl] Work received: workId=${i} workSessionId=${t} currentSessionId=${B} match=${Ve(t,B)}`),M(r,{sessionId:B,environmentId:L,source:`repl`}),!Ve(t,B)){x(`[bridge:repl] Rejecting foreign session: expected=${B} got=${t}`);return}q=i,J=n;let o=a||e(process.env.CLAUDE_BRIDGE_USE_CCR_V2),s;if(!o){if(s=Se(),!s){x(`[bridge:repl] No OAuth token available for session ingress, skipping work`);return}le(s)}if(j(`tengu_bridge_repl_work_received`,{}),U){let e=U;U=null;let t=e.getLastSequenceNum();t>G&&(G=t),e.close()}X.deactivate();let c=e=>xe(e,{transport:U,sessionId:B,onInterrupt:re,onSetModel:w,onSetMaxThinkingTokens:ie,onSetPermissionMode:E}),d=!1,f=e=>{U=e,e.setOnConnect(()=>{if(U===e){if(x(`[bridge:repl] Ingress transport connected`),j(`tengu_bridge_repl_ws_connected`,{}),!o){let e=Se();e&&le(e)}if(Re=!1,!d&&S&&S.length>0){d=!0;let t=b,n=S.filter(e=>ve(e)&&!C?.has(e.uuid)),r=t>0&&n.length>t?n.slice(-t):n;r.length<n.length&&(x(`[bridge:repl] Capped initial flush: ${n.length} -> ${r.length} (cap=${t})`),j(`tengu_bridge_repl_history_capped`,{eligible_count:n.length,capped_count:r.length}));let i=g(r);if(i.length>0){x(`[bridge:repl] Flushing ${i.length} initial message(s) via transport`);let t=i.map(e=>({...e,session_id:B})),n=e.droppedBatchCount;e.writeBatch(t).then(()=>{if(e.droppedBatchCount>n){x(`[bridge:repl] Initial flush dropped ${e.droppedBatchCount-n} batch(es) — not marking ${i.length} UUID(s) as flushed`);return}if(C)for(let e of i)e.uuid&&C.add(e.uuid)}).catch(e=>x(`[bridge:repl] Initial flush failed: ${e}`)).finally(()=>{U===e&&(De(),D?.(`connected`))})}else De(),D?.(`connected`)}else X.active||D?.(`connected`)}}),e.setOnData(e=>{try{let t=JSON.parse(e);Pe(`ingress: type=${t.type}${t.type===`control_request`?` subtype=${t.request?.subtype} request_id=${t.request_id}`:``}${t.type===`control_response`?` subtype=${t.response?.subtype} request_id=${t.response?.request_id}`:``}${t.type===`user`?` uuid=${t.uuid}`:``}${t.type===`keep_alive`?``:` len=${e.length}`}`)}catch{Pe(`ingress (non-JSON): ${String(e).slice(0,200)}`)}Te(e,V,me,te,ne,c)}),e.setOnClose(t=>{U===e&&(Pe(`transport onClose: code=${t} connected=${e.isConnectedStatus()} state=${e.getStateLabel()} seq=${e.getLastSequenceNum()}`),Fe(t))}),!d&&S&&S.length>0&&X.start(),e.connect()};if(W++,o){let e=We(l,t),r=W;x(`[bridge:repl] CCR v2: sessionUrl=${e} session=${t} gen=${r}`),Ae({sessionUrl:e,ingressToken:n,sessionId:t,initialSequenceNum:G}).then(e=>{if(H.signal.aborted){e.close();return}if(r!==W){x(`[bridge:repl] CCR v2: discarding stale handshake gen=${r} current=${W}`),e.close();return}f(e)},e=>{x(`[bridge:repl] CCR v2: createV2ReplTransport failed: ${y(e)}`,{level:`error`}),j(`tengu_bridge_repl_ccr_v2_init_failed`,{}),r===W&&(q&&(F.stopWork(L,q,!1).catch(e=>{x(`[bridge:repl] stopWork after v2 init failure: ${y(e)}`)}),q=null,J=null),Y())})}else{let e=He(u,t);x(`[bridge:repl] Ingress URL: ${e}`),x(`[bridge:repl] Creating HybridTransport: session=${t}`);let n=s??``;f(ke(new Ke(new URL(e),{Authorization:`Bearer ${n}`,"anthropic-version":`2023-06-01`},t,()=>({Authorization:`Bearer ${Se()??n}`,"anthropic-version":`2023-06-01`}),{maxConsecutiveFailures:50,isBridge:!0,onBatchDropped:()=>{D?.(`reconnecting`,`Lost sync with Remote Control — events could not be delivered`),Y()}})))}}});let Ie=k?setInterval(()=>{Q||M(r,{sessionId:B,environmentId:L,source:`repl`})},60*6e4):null;Ie?.unref?.();let Le=v().session_keepalive_interval_v2_ms,$=Le>0?setInterval(()=>{U&&(x(`[bridge:repl] keep_alive sent`),U.write({type:`keep_alive`}).catch(e=>{x(`[bridge:repl] keep_alive write failed: ${y(e)}`)}))},Le):null;$?.unref?.();let Re=!1;Oe=async()=>{if(Re){x(`[bridge:repl] Teardown already in progress, skipping duplicate call env=${L} session=${B}`);return}Re=!0;let e=Date.now();if(x(`[bridge:repl] Teardown starting: env=${L} session=${B} workId=${q??`none`} transportState=${U?.getStateLabel()??`null`}`),Ie!==null&&clearInterval(Ie),$!==null&&clearInterval($),H.abort(),x(`[bridge:repl] Teardown: poll loop aborted`),U){let e=U.getLastSequenceNum();e>G&&(G=e)}if(k){U=null,X.drop(),await M(r,{sessionId:B,environmentId:L,source:`repl`}),x(`[bridge:repl] Teardown (perpetual): leaving env=${L} session=${B} alive on server, duration=${Date.now()-e}ms`);return}let t=U;if(U=null,X.drop(),t){let e={...we(B),session_id:B};t.write(e)}let n=q?F.stopWork(L,q,!0).then(()=>{x(`[bridge:repl] Teardown: stopWork completed`)}).catch(e=>{x(`[bridge:repl] Teardown stopWork failed: ${y(e)}`)}):Promise.resolve();await Promise.all([n,m(B)]),t?.close(),x(`[bridge:repl] Teardown: transport closed`),await F.deregisterEnvironment(L).catch(e=>{x(`[bridge:repl] Teardown deregister failed: ${y(e)}`)}),await N(r),x(`[bridge:repl] Teardown complete: env=${L} duration=${Date.now()-e}ms`)};let Ue=ee(()=>Oe?.());return x(`[bridge:repl] Ready: env=${L} session=${B}`),D?.(`ready`),{get bridgeSessionId(){return B},get environmentId(){return L},getSSESequenceNum(){let e=U?.getLastSequenceNum()??0;return Math.max(G,e)},sessionIngressUrl:u,writeMessages(e){let t=e.filter(e=>ve(e)&&!pe.has(e.uuid)&&!V.has(e.uuid));if(t.length===0)return;if(!_e)for(let e of t){let t=Ce(e);if(t!==void 0&&O?.(t,B)){_e=!0;break}}if(X.enqueue(...t)){x(`[bridge:repl] Queued ${t.length} message(s) during initial flush`);return}if(!U){let e=t.map(e=>e.type).join(`,`);x(`[bridge:repl] Transport not configured, dropping ${t.length} message(s) [${e}] for session=${B}`,{level:`warn`});return}for(let e of t)V.add(e.uuid);x(`[bridge:repl] Sending ${t.length} message(s) via transport`);let n=g(t).map(e=>({...e,session_id:B}));U.writeBatch(n)},writeSdkMessages(e){let t=e.filter(e=>!e.uuid||!V.has(e.uuid));if(t.length===0)return;if(!U){x(`[bridge:repl] Transport not configured, dropping ${t.length} SDK message(s) for session=${B}`,{level:`warn`});return}for(let e of t)e.uuid&&V.add(e.uuid);let n=t.map(e=>({...e,session_id:B}));U.writeBatch(n)},sendControlRequest(e){if(!U){x(`[bridge:repl] Transport not configured, skipping control_request`);return}let t={...e,session_id:B};U.write(t),x(`[bridge:repl] Sent control_request request_id=${e.request_id}`)},sendControlResponse(e){if(!U){x(`[bridge:repl] Transport not configured, skipping control_response`);return}let t={...e,session_id:B};U.write(t),x(`[bridge:repl] Sent control_response`)},sendControlCancelRequest(e){if(!U){x(`[bridge:repl] Transport not configured, skipping control_cancel_request`);return}let t={type:`control_cancel_request`,request_id:e,session_id:B};U.write(t),x(`[bridge:repl] Sent control_cancel_request request_id=${e}`)},sendResult(){if(!U){x(`[bridge:repl] sendResult: skipping, transport not configured session=${B}`);return}U.reportState(`idle`);let e={...we(B),session_id:B};U.write(e),x(`[bridge:repl] Sent result for session=${B}`)},async teardown(){Ue(),await Oe?.(),x(`[bridge:repl] Torn down`),j(`tengu_bridge_repl_teardown`,{})}}}async function et({api:e,getCredentials:t,signal:n,onStateChange:r,onWorkReceived:i,onEnvironmentLost:a,getWsState:o,isAtCapacity:s,capacitySignal:c,onFatalError:l,getPollIntervalConfig:u=()=>Me,getHeartbeatInfo:d,onHeartbeatFatal:f}){x(`[bridge:repl] Starting work poll loop for env=${t().environmentId}`);let p=0,m=null,h=null,g=0,_=!1;for(;!n.aborted;){let{environmentId:v,environmentSecret:b}=t(),S=u();try{let t=await e.pollForWork(v,b,n,S.reclaim_older_than_ms);if(g=0,p>0&&(x(`[bridge:repl] Poll recovered after ${p} consecutive error(s)`),p=0,m=null,h=null,r?.(`ready`)),!t){let t=_;if(_=!1,s?.()&&c&&!t){let t=S.poll_interval_ms_at_capacity;if(S.non_exclusive_heartbeat_interval_ms>0&&d){j(`tengu_bridge_heartbeat_mode_entered`,{heartbeat_interval_ms:S.non_exclusive_heartbeat_interval_ms});let r=t>0?Date.now()+t:null,i=!1,a=0;for(;!n.aborted&&s()&&(r===null||Date.now()<r);){let t=u();if(t.non_exclusive_heartbeat_interval_ms<=0)break;let n=d();if(!n)break;let r=c();try{await e.heartbeatWork(n.environmentId,n.workId,n.sessionToken)}catch(e){if(x(`[bridge:repl:heartbeat] Failed: ${y(e)}`),e instanceof $){r.cleanup(),j(`tengu_bridge_heartbeat_error`,{status:e.status,error_type:e.status===401||e.status===403?`auth_failed`:`fatal`}),f?(f(e),x(`[bridge:repl:heartbeat] Fatal (status=${e.status}), work state cleared — fast-polling for re-dispatch`)):i=!0;break}}a++,await I(t.non_exclusive_heartbeat_interval_ms,r.signal),r.cleanup()}let o=i?`error`:n.aborted?`shutdown`:s()?r!==null&&Date.now()>=r?`poll_due`:`config_disabled`:`capacity_changed`;if(j(`tengu_bridge_heartbeat_mode_exited`,{reason:o,heartbeat_cycles:a}),!i){o===`poll_due`&&x(`[bridge:repl] Heartbeat poll_due after ${a} cycles — falling through to pollForWork`);continue}}let r=t>0?t:S.non_exclusive_heartbeat_interval_ms;if(r>0){let e=c(),t=Date.now();await I(r,e.signal),e.cleanup();let n=Date.now()-t-r;n>6e4&&(x(`[bridge:repl] At-capacity sleep overran by ${Math.round(n/1e3)}s — process suspension detected, forcing one fast-poll cycle`),j(`tengu_bridge_repl_suspension_detected`,{overrun_ms:n}),_=!0)}}else await I(S.poll_interval_ms_not_at_capacity,n);continue}let a;try{a=Ue(t.secret)}catch(n){x(`[bridge:repl] Failed to decode work secret: ${y(n)}`),j(`tengu_bridge_repl_work_secret_failed`,{}),await e.stopWork(v,t.id,!1).catch(()=>{});continue}x(`[bridge:repl] Acknowledging workId=${t.id}`);try{await e.acknowledgeWork(v,t.id,a.session_ingress_token)}catch(e){x(`[bridge:repl] Acknowledge failed workId=${t.id}: ${y(e)}`)}if(t.data.type===`healthcheck`){x(`[bridge:repl] Healthcheck received`);continue}if(t.data.type===`session`){let e=t.data.id;try{Re(e,`session_id`)}catch{x(`[bridge:repl] Invalid session_id in work: ${e}`);continue}i(e,a.session_ingress_token,t.id,a.use_code_sessions===!0),x(`[bridge:repl] Work accepted, continuing poll loop`)}}catch(i){if(n.aborted)break;if(i instanceof $&&i.status===404&&a){let e=t().environmentId;if(v!==e){x(`[bridge:repl] Stale poll error for old env=${v}, current env=${e} — skipping onEnvironmentLost`),p=0,m=null;continue}if(g++,x(`[bridge:repl] Environment deleted, attempting re-registration (attempt ${g}/3)`),j(`tengu_bridge_repl_env_lost`,{attempt:g}),g>3){x(`[bridge:repl] Environment re-registration limit reached (3), giving up`),r?.(`failed`,`Environment deleted and re-registration limit reached`),l?.();break}r?.(`reconnecting`,`environment lost, recreating session`);let i=await a();if(n.aborted)break;if(i){p=0,m=null,r?.(`ready`),x(`[bridge:repl] Re-registered environment: ${i.environmentId}`);continue}r?.(`failed`,`Environment deleted and re-registration failed`),l?.();break}if(i instanceof $){let e=Le(i.errorType),t=Ie(i);x(`[bridge:repl] Fatal poll error: ${i.message} (status=${i.status}, type=${i.errorType??`unknown`})${t?` (suppressed)`:``}`),j(`tengu_bridge_repl_fatal_error`,{status:i.status,error_type:i.errorType}),T(e?`info`:`error`,`bridge_repl_fatal_error`,{status:i.status,error_type:i.errorType}),t||r?.(`failed`,e?`session expired · /remote-control to reconnect`:i.message),l?.();break}let s=Date.now();h!==null&&s-h>6e4*2&&(x(`[bridge:repl] Detected system sleep (${Math.round((s-h)/1e3)}s gap), resetting poll error budget`),T(`info`,`bridge_repl_poll_sleep_detected`,{gapMs:s-h}),p=0,m=null),h=s,p++,m===null&&(m=s);let c=s-m,f=U(i),_=G(i),y=o?.()??`unknown`;if(x(`[bridge:repl] Poll error (attempt ${p}, elapsed ${Math.round(c/1e3)}s, ws=${y}): ${_}`),j(`tengu_bridge_repl_poll_error`,{status:f,consecutiveErrors:p,elapsedMs:c}),p===1&&r?.(`reconnecting`,_),c>=9e5){x(`[bridge:repl] Poll failures exceeded ${Ze/1e3}s (${p} errors), giving up`),T(`info`,`bridge_repl_poll_give_up`),j(`tengu_bridge_repl_poll_give_up`,{consecutiveErrors:p,elapsedMs:c,lastStatus:f}),r?.(`failed`,`connection to server lost`);break}let b=Math.min(Ye*2**(p-1),Xe);if(u().non_exclusive_heartbeat_interval_ms>0){let t=d?.();if(t)try{await e.heartbeatWork(t.environmentId,t.workId,t.sessionToken)}catch{}}await I(b,n)}}x(`[bridge:repl] Work poll loop ended (aborted=${n.aborted}) env=${t().environmentId}`)}S(),b(),W(),z();async function tt(e){let{onInboundMessage:t,onPermissionResponse:n,onInterrupt:i,onSetModel:a,onSetMaxThinkingTokens:s,onSetPermissionMode:l,onStateChange:p,initialMessages:m,getMessages:g,previouslyFlushedUUIDs:b,initialName:S,perpetual:ee,outboundOnly:C,tags:ne}=e??{};if(fe(ye),!await De())return K(`not_enabled`,`[bridge:repl] Skipping: bridge not enabled`),null;if(!H())return K(`no_oauth`,`[bridge:repl] Skipping: no OAuth tokens`),p?.(`failed`,`authentication required`),null;if(await f(),!u(`allow_remote_control`))return K(`policy_denied`,`[bridge:repl] Skipping: allow_remote_control policy not allowed`),p?.(`failed`,`disabled by your organization's policy`),null;if(!pe()){let e=te();if(e.bridgeOauthDeadExpiresAt!=null&&(e.bridgeOauthDeadFailCount??0)>=3&&oe()?.expiresAt===e.bridgeOauthDeadExpiresAt)return x(`[bridge:repl] Skipping: cross-process backoff (dead token seen ${e.bridgeOauthDeadFailCount} times)`),null;await F();let t=oe();if(t&&t.expiresAt!==null&&t.expiresAt<=Date.now()){K(`oauth_expired_unrefreshable`,`[bridge:repl] Skipping: OAuth token expired and refresh failed (re-login required)`),p?.(`failed`,`authentication required`);let e=t.expiresAt;return re(t=>({...t,bridgeOauthDeadExpiresAt:e,bridgeOauthDeadFailCount:t.bridgeOauthDeadExpiresAt===e?(t.bridgeOauthDeadFailCount??0)+1:1})),null}}let w=V(),T=`remote-control-${h()}`,E=!1,O=!1;if(S)T=S,E=!0,O=!0;else{let e=v(),t=e?d(e):void 0;if(t)T=t,E=!0,O=!0;else if(m&&m.length>0)for(let e=m.length-1;e>=0;e--){let t=m[e];if(t.type!==`user`||t.isMeta||t.toolUseResult||t.isCompactSummary||t.origin&&t.origin.kind!==`human`||c(t))continue;let n=r(t.message.content);if(!n)continue;let i=rt(n);if(i){T=i,E=!0;break}}}let k=0,A,j=0,ae=(e,t,n)=>{E=!0,T=e,x(`[bridge:repl] derived title from message ${n}: ${e}`),q(t,e,{baseUrl:w,getAccessToken:H}).catch(()=>{})},M=(e,t)=>{let n=++j,r=k;_e(e,AbortSignal.timeout(15e3)).then(e=>{e&&n===j&&A===t&&!d(v())&&ae(e,t,r)})},P=(e,t)=>{if(O||d(v()))return!0;if(A!==void 0&&A!==t&&(k=0),A=t,k++,k===1&&!E){let n=rt(e);n&&ae(n,t,k),M(e,t)}else if(k===3){let n=g?.(),r=n?Q(o(n)):e;M(r,t)}return k>=3},I=me()?`self-hosted`:await se();if(!I)return K(`no_org_uuid`,`[bridge:repl] Skipping: no org UUID`),p?.(`failed`,`/login`),null;if(be()&&!ee){let e=await Oe();if(e)return K(`version_too_old`,`[bridge:repl] Skipping: ${e}`,!0),p?.(`failed`,"run `claude update` to upgrade"),null;x(`[bridge:repl] Using env-less bridge path (tengu_bridge_repl_v2)`);let{initEnvLessBridgeCore:r}=await import(`./remoteBridgeCore-BGOqHADF.js`);return r({baseUrl:w,orgUUID:I,title:T,getAccessToken:H,onAuth401:N,toSDKMessages:X,initialHistoryCap:200,initialMessages:m,onInboundMessage:t,onUserMessage:P,onPermissionResponse:n,onInterrupt:i,onSetModel:a,onSetMaxThinkingTokens:s,onSetPermissionMode:l,onStateChange:p,outboundOnly:C,tags:ne})}let L=Se();if(L)return K(`version_too_old`,`[bridge:repl] Skipping: ${L}`),p?.(`failed`,"run `claude update` to upgrade"),null;let ce=await ie(),le=await D(),R=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||w;return $e({dir:_(),machineName:qe(),branch:ce,gitRepoUrl:le,title:T,baseUrl:w,sessionIngressUrl:R,workerType:`claude_code`,getAccessToken:H,createSession:e=>he({...e,events:[],baseUrl:w,getAccessToken:H}),archiveSession:e=>Y(e,{baseUrl:w,getAccessToken:H,timeoutMs:1500}).catch(e=>{x(`[bridge:repl] archiveBridgeSession threw: ${y(e)}`,{level:`error`})}),getCurrentTitle:()=>d(v())??T,onUserMessage:P,toSDKMessages:X,onAuth401:N,getPollIntervalConfig:Ne,initialHistoryCap:200,initialMessages:m,previouslyFlushedUUIDs:b,onInboundMessage:t,onPermissionResponse:n,onInterrupt:i,onSetModel:a,onSetMaxThinkingTokens:s,onSetPermissionMode:l,onStateChange:p,perpetual:ee})}var nt=50;function rt(e){let t=O(e),n=(/^(.*?[.!?])\s/.exec(t)?.[1]??t).replace(/\s+/g,` `).trim();if(n)return n.length>nt?n.slice(0,nt-1)+`…`:n}export{tt as initReplBridge};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$T as t,QT as n,ZT as r,aE as i,iE as a,nE as o,oE as s,sE as c}from"./loadAgentsDir-BXtV2jiO.js";import{C as l,F as u,R as d,x as f}from"./debug-Dr1SjdXn.js";import{r as p,t as m}from"./promptEditor-Bo1d8ZLq.js";import{dirname as h}from"path";import{mkdir as g,writeFile as _}from"fs/promises";function v(e){let t=new Set(o.map(e=>i(e.key)));return e.map(e=>{let n={};for(let[r,a]of Object.entries(e.bindings))t.has(i(r))||(n[r]=a);return{context:e.context,bindings:n}}).filter(e=>Object.keys(e.bindings).length>0)}function y(){return l({$schema:`https://www.schemastore.org/claude-code-keybindings.json`,$docs:`https://code.workmate.com/docs/en/keybindings`,bindings:v(s)},null,2)+`
|
|
2
|
-
`}var b=e((()=>{f(),c(),a()}));async function x(){if(!t())return{type:`text`,value:`Keybinding customization is not enabled. This feature is currently in preview.`};let e=r(),n=!1;await g(h(e),{recursive:!0});try{await _(e,y(),{encoding:`utf-8`,flag:`wx`})}catch(e){if(u(e)===`EEXIST`)n=!0;else throw e}let i=await m(e);return i.error?{type:`text`,value:`${n?`Opened`:`Created`} ${e}. Could not open in editor: ${i.error}`}:{type:`text`,value:n?`Opened ${e} in your editor.`:`Created ${e} with template. Opened in your editor.`}}e((()=>{n(),b(),d(),p()}))();export{x as call};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,I as n,P as r,fi as i,t as a,x as o}from"./src-P_wYS_NJ2.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{c,h as l,v as u,y as d}from"./config-9rLTDOYW.js";import{n as f,r as p}from"./analytics-DJobLaWP.js";import{n as m,t as h}from"./ThemePicker-p7_hHk1V.js";function g(e){return e}function _(e){let t=e.trim().toLowerCase();return t===``||t===`reset`?{sub:`full`}:x.has(t)?{sub:t}:{sub:`full`,unknownArg:t}}function v({onDone:e}){let[,n]=t();return(0,b.jsx)(o,{color:`permission`,children:(0,b.jsx)(h,{onThemeSelect:t=>{n(t),p(`tengu_onboarding_step`,{stepId:g(`theme`)}),e(`Theme set to ${t}.`)},onCancel:()=>e(`Theme picker dismissed.`),skipExitHandling:!0})})}function y({theme:e,hasCompletedOnboarding:t,lastOnboardingVersion:i}){return(0,b.jsxs)(n,{flexDirection:`column`,paddingLeft:1,children:[(0,b.jsx)(r,{bold:!0,children:`Onboarding status`}),(0,b.jsxs)(r,{children:[`- Theme: `,(0,b.jsx)(r,{bold:!0,children:e})]}),(0,b.jsxs)(r,{children:[`- Onboarding completed:`,` `,(0,b.jsx)(r,{bold:!0,color:t?`success`:`warning`,children:t?`yes`:`no`})]}),(0,b.jsxs)(r,{children:[`- Last onboarding version: `,(0,b.jsx)(r,{bold:!0,children:i})]}),(0,b.jsx)(r,{dimColor:!0,children:`Run /onboarding (no args) to re-run the full flow, or /onboarding theme | trust | model | mcp for a specific step.`})]})}var b,x,S;e((()=>{i(),a(),f(),m(),l(),b=s(),x=new Set([`full`,`theme`,`trust`,`model`,`mcp`,`status`]),S=async(e,t,n)=>{let{sub:r,unknownArg:i}=_(n);if(p(`tengu_onboarding_step`,{stepId:g(`slash_${r}`)}),i!==void 0)return e(`Unknown /onboarding subcommand: \`${i}\`.\nValid: full | theme | trust | model | mcp | status`,{display:`system`}),null;if(r===`theme`)return(0,b.jsx)(v,{onDone:t=>e(t)});if(r===`trust`)return u(e=>({...e,hasTrustDialogAccepted:!1})),e("Workspace trust cleared for the current project. The trust dialog will appear on the next `claude` launch.",{display:`system`}),null;if(r===`model`)return e("Run `/model` to pick the AI model. Onboarding does not own the model picker; this entry exists for discoverability only.",{display:`system`}),null;if(r===`mcp`)return e("MCP server setup:\n - `/mcp` — list configured MCP servers\n - `claude mcp add <name> <command>` — add a server (in your shell)\n - `claude mcp remove <name>` — remove a server\nServers also load from `.mcp.json` in the workspace and from `~/.workmate.json` globally.",{display:`system`}),null;if(r===`status`){let e=c();return(0,b.jsx)(y,{theme:e.theme??`(unset)`,hasCompletedOnboarding:e.hasCompletedOnboarding===!0,lastOnboardingVersion:e.lastOnboardingVersion??`(unset)`})}return d(e=>({...e,hasCompletedOnboarding:!1})),e(`Onboarding flag cleared. The full first-run setup (theme, OAuth/API key, security notes, terminal-setup) will run on the next \`claude\` launch.
|
|
2
|
-
|
|
3
|
-
For individual steps in this session, use:
|
|
4
|
-
/onboarding theme — re-pick theme inline
|
|
5
|
-
/onboarding trust — re-confirm workspace trust on next launch
|
|
6
|
-
/onboarding model — open /model picker
|
|
7
|
-
/onboarding mcp — show MCP setup hints
|
|
8
|
-
/onboarding status — show current onboarding state`,{display:`system`}),null}}))();export{S as callOnboarding};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e,t}from"./loadAgentsDir-BXtV2jiO.js";e();export{t as clearAgentDefinitionsCache};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A_ as e,N_ as t,j_ as n}from"./loadAgentsDir-BXtV2jiO.js";e();export{n as loadPluginHooks,t as setupPluginHookHotReload};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{c as n,i as r}from"./debug-Dr1SjdXn.js";var i=t({clearSkillIndexCache:()=>m,computeIdf:()=>u,computeWeightedTf:()=>l,cosineSimilarity:()=>d,getSkillIndex:()=>h,searchSkills:()=>g,tokenize:()=>o,tokenizeAndStem:()=>c});function a(e){return v.test(e)}function o(e){let t=[],n=e.toLowerCase(),r=0;for(;r<n.length;)if(a(n[r])){let e=``;for(;r<n.length&&a(n[r]);)e+=n[r],r++;for(let n=0;n<e.length-1;n++)t.push(e.slice(n,n+2))}else if(/[a-z0-9]/.test(n[r])){let e=``;for(;r<n.length&&/[a-z0-9\-_]/.test(n[r]);)e+=n[r],r++;let i=e.replace(/^[-_]+|[-_]+$/g,``);i&&!_.has(i)&&t.push(i)}else r++;return t}function s(e){if(a(e[0]??``))return e;let t=e;return t.endsWith(`ing`)&&t.length>5?t=t.slice(0,-3):t.endsWith(`tion`)&&t.length>5||t.endsWith(`ness`)&&t.length>5||t.endsWith(`ment`)&&t.length>5?t=t.slice(0,-4):t.endsWith(`ers`)&&t.length>4?t=t.slice(0,-1):t.endsWith(`er`)&&t.length>4||t.endsWith(`es`)&&t.length>4?t=t.slice(0,-2):t.endsWith(`s`)&&t.length>3&&!t.endsWith(`ss`)?t=t.slice(0,-1):(t.endsWith(`ed`)&&t.length>4||t.endsWith(`ly`)&&t.length>4)&&(t=t.slice(0,-2)),t}function c(e){return o(e).map(s)}function l(e){let t=new Map;for(let n of e){let e=new Map;for(let t of n.tokens)e.set(t,(e.get(t)??0)+1);let r=1;for(let t of e.values())t>r&&(r=t);for(let[i,a]of e){let e=a/r*n.weight;e>(t.get(i)??0)&&t.set(i,e)}}return t}function u(e){let t=new Map;for(let n of e){let e=new Set;for(let r of n.tokens)e.has(r)||(t.set(r,(t.get(r)??0)+1),e.add(r))}let n=e.length,r=new Map;for(let[e,i]of t)r.set(e,Math.log(n/i));return r}function d(e,t){let n=0,r=0,i=0;for(let[i,a]of e){let e=t.get(i)??0;n+=a*e,r+=a*a}for(let e of t.values())i+=e*e;let a=Math.sqrt(r)*Math.sqrt(i);return a===0?0:n/a}function f(e){return e.toLowerCase().replace(/[-_]/g,` `)}function p(e){return e.toLowerCase().split(/[-_]/).filter(e=>e.length>=3)}function m(){C=null,w=null,T=null,n(`[skill-search] index cache cleared`)}async function h(e){if(C&&T===e)return C;let{getCommands:t}=await import(`./commands-D_-v6_A0.js`),r=await t(e),i=[];for(let e of r){if(e.type!==`prompt`||e.disableModelInvocation)continue;let t=e.name,n=e.description??``,r=e.whenToUse,a=e.allowedTools?.join(` `)??``,o=c(t),u=p(t),d=[...o,...u.map(s).filter(e=>!_.has(e))],m=c(n),h=c(r??``),g=c(a),v=[...new Set([...d,...m,...h,...g])],b=l([{tokens:d,weight:y.name},{tokens:h,weight:y.whenToUse},{tokens:m,weight:y.description},{tokens:g,weight:y.allowedTools}]);i.push({name:t,normalizedName:f(t),description:n,whenToUse:r,source:e.source??`unknown`,loadedFrom:e.loadedFrom,skillRoot:e.skillRoot,contentLength:e.contentLength,tokens:v,tfVector:b})}let a=u(i);for(let e of i)for(let[t,n]of e.tfVector)e.tfVector.set(t,n*(a.get(t)??0));return C=i,w=a,T=e,n(`[skill-search] indexed ${i.length} skills from ${r.length} commands`),i}function g(e,t,n=5){if(t.length===0||!e?.trim())return[];let r=c(e);if(r.length===0)return[];let i=new Map,o=new Map;for(let e of r)o.set(e,(o.get(e)??0)+1);let s=1;for(let e of o.values())e>s&&(s=e);for(let[e,t]of o)i.set(e,t/s);let l=C===t&&w?w:u(t),f=new Map;for(let[e,t]of i)f.set(e,t*(l.get(e)??0));let p=r.filter(e=>a(e[0]??``)),m=r.filter(e=>!a(e[0]??``)),h=e.toLowerCase().replace(/[-_]/g,` `),g=[];for(let e of t){let t=d(f,e.tfVector);p.length>0&&t>0&&p.filter(t=>e.tfVector.has(t)).length<S&&(m.some(t=>e.tfVector.has(t))||(t=0)),e.name.length>=x&&h.includes(e.normalizedName)&&(t=Math.max(t,.75)),t>=b&&g.push({name:e.name,description:e.description,score:t,source:e.source,loadedFrom:e.loadedFrom,skillRoot:e.skillRoot,contentLength:e.contentLength})}return g.sort((e,t)=>t.score-e.score),g.slice(0,n)}var _,v,y,b,x,S,C,w,T,E=e((()=>{r(),_=new Set(`a.an.the.is.are.was.were.be.been.being.have.has.had.do.does.did.will.would.could.should.may.might.shall.can.need.dare.ought.used.to.of.in.for.on.with.at.by.from.as.into.through.during.before.after.above.below.between.out.off.over.under.again.further.then.once.here.there.when.where.why.how.all.each.every.both.few.more.most.other.some.such.no.nor.not.only.own.same.so.than.too.very.just.because.but.and.or.if.while.this.that.these.those.it.its.i.me.my.we.our.you.your.he.him.his.she.her.they.them.their.what.which.who.whom.use.using.used`.split(`.`)),v=/[\u4e00-\u9fff\u3400-\u4dbf]/,y={name:3,whenToUse:2,description:1,allowedTools:.3},b=Number(process.env.SKILL_SEARCH_DISPLAY_MIN_SCORE??`0.10`),x=4,S=2,C=null,w=null,T=null}));export{h as a,g as c,d as i,o as l,u as n,E as o,l as r,i as s,m as t,c as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,c as t,o as n,t as r}from"./localSearch-CeP4ef0a.js";n();export{r as clearSkillIndexCache,e as getSkillIndex,t as searchSkills};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=async()=>{},t=async()=>{},n=async()=>null;export{n as probeRunningServer,t as removeServerLock,e as writeServerLock};
|