@readmagic/workmate 0.0.12 → 0.0.13
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-CtRxzRny.js → AddWorkspaceDirectory-BzNj9rS6.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-CDZPR488.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-_yJJ0wqu.js → AgentsMdExternalIncludesDialog-CH9x1Ngp.js} +1 -1
- package/dist/chunks/App-D-bYAYAl.js +1 -0
- package/dist/chunks/ApproveApiKey-BEGV9Zj9.js +1 -0
- package/dist/chunks/ApproveApiKey-CjacpIqq.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-A9hw_SV0.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-COI_V57z.js → BypassPermissionsModeDialog-B0BizN_J.js} +1 -1
- package/dist/chunks/{DiffDialog-CRWtQ1R5.js → DiffDialog-mQ-5_TSv.js} +3 -3
- package/dist/chunks/Doctor-BC6IuQhd.js +3 -0
- package/dist/chunks/Doctor-i_5_AQd-.js +1 -0
- package/dist/chunks/ExitFlow-Bu2cVGpC.js +2 -0
- package/dist/chunks/{Grove-DRZrhbF0.js → Grove-D0nn8zOV.js} +2 -2
- package/dist/chunks/{HybridTransport-BadJQe6u.js → HybridTransport-BQNLZNa_.js} +2 -2
- package/dist/chunks/InvalidConfigDialog-C5CIiSIE.js +1 -0
- package/dist/chunks/{InvalidSettingsDialog-ISzcIGPU.js → InvalidSettingsDialog-Dq7hKXcO.js} +1 -1
- package/dist/chunks/MCPConnectionManager-aDDsYkGM.js +1 -0
- package/dist/chunks/MCPToolListView-Cr0MDkzT.js +1 -0
- package/dist/chunks/{McpParsingWarnings-xv0RZCSL.js → McpParsingWarnings-CUx2zexI.js} +1 -1
- package/dist/chunks/MessageSelector-DwGOWKKL.js +3 -0
- package/dist/chunks/Messages-C1jh4ixt.js +11 -0
- package/dist/chunks/Onboarding-t-P6Q5O6.js +1 -0
- package/dist/chunks/{PromptInputFooterSuggestions-8-awCxOn.js → PromptInputFooterSuggestions-R12fbdmp.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-BgADIzRj.js +1 -0
- package/dist/chunks/QueryEngine-HlLQJmsd.js +1 -0
- package/dist/chunks/REPL-Rs_JQkDc.js +1 -0
- package/dist/chunks/REPL-VKAmKkII.js +133 -0
- package/dist/chunks/RemoteSessionManager-BbgXeM-t.js +2 -0
- package/dist/chunks/ResumeConversation-66zbx12g.js +1 -0
- package/dist/chunks/{SSETransport-je346ofV.js → SSETransport-BBQkdn4e.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-Bq87I_vu.js +1 -0
- package/dist/chunks/Settings-BKdLcyXe.js +2 -0
- package/dist/chunks/{TeleportProgress-zmdAsogZ.js → TeleportProgress-3hmIApkj.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-CG32I4cO.js → TeleportRepoMismatchDialog-BA1a66RK.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-2Yjr74Lq.js → TeleportResumeWrapper-BT4O-Wsi.js} +1 -1
- package/dist/chunks/{ThemePicker-p7_hHk1V.js → ThemePicker-DUlhcoso.js} +1 -1
- package/dist/chunks/{TrustDialog-BVcny9vs.js → TrustDialog-Dpk03V1Y.js} +1 -1
- package/dist/chunks/add-dir-BUr0z-VU.js +1 -0
- package/dist/chunks/{agentDisplay-CfMLGPGH.js → agentDisplay-D7bdOOG7.js} +1 -1
- package/dist/chunks/{agents-BT82hwBN.js → agents-22wiC58F.js} +1 -1
- package/dist/chunks/agents-8ELI8RJo.js +103 -0
- package/dist/chunks/{allErrors-CS77lRvU.js → allErrors-C1eMbHSv.js} +1 -1
- package/dist/chunks/api-DgjIFdMn.js +1 -0
- package/dist/chunks/{api-DAubp5q9.js → api-f3GN2I_J.js} +1 -1
- package/dist/chunks/auth-B73a4Cob.js +1 -0
- package/dist/chunks/{auth-yDsvFcM7.js → auth-Czy7GoRh.js} +1 -1
- package/dist/chunks/auth-D_0waidQ.js +1 -0
- package/dist/chunks/backgroundHousekeeping-C_ArdTFX.js +17 -0
- package/dist/chunks/backgroundHousekeeping-YJhvZ0dh.js +1 -0
- package/dist/chunks/{branch-DJiMa8td.js → branch-bb4-bErF.js} +2 -2
- package/dist/chunks/{bridgeConfig-BB6Hgali.js → bridgeConfig-B80T_lw7.js} +1 -1
- package/dist/chunks/bridgeConfig-DywkIo_k.js +1 -0
- package/dist/chunks/{bridgeMessaging-C9D0Lly2.js → bridgeMessaging-DyvHd16Z.js} +1 -1
- package/dist/chunks/{bridgeStatusUtil-D8UbcVrZ.js → bridgeStatusUtil-DStiD05t.js} +1 -1
- package/dist/chunks/{btw-BO2B23f-.js → btw-BRmV51bR.js} +1 -1
- package/dist/chunks/caches-C5DIVdvI.js +1 -0
- package/dist/chunks/caches-zDZEgNKq.js +1 -0
- package/dist/chunks/{ccrClient-BG9HU_fW.js → ccrClient-BALhzhPF.js} +1 -1
- package/dist/chunks/{clear-B4XN2fib.js → clear-B_yVyJXP.js} +1 -1
- package/dist/chunks/client-DVg8PpFX.js +1 -0
- package/dist/chunks/commands-ByFXqW43.js +1 -0
- package/dist/chunks/compact-BUShp2eQ.js +2 -0
- package/dist/chunks/config-BwHNU_pI.js +1 -0
- package/dist/chunks/{context-BY5oO5is.js → context-6Pk3iVhh.js} +1 -1
- package/dist/chunks/{context-noninteractive-mAQt1p9l.js → context-noninteractive-CHzerxnH.js} +2 -2
- package/dist/chunks/context-noninteractive-DFwRQyFE.js +1 -0
- package/dist/chunks/conversation-5zb5XkSA.js +1 -0
- package/dist/chunks/conversation-JP2ZXrwu.js +1 -0
- package/dist/chunks/{createSSHSession-DjLSGm-0.js → createSSHSession-XkHMiGRN.js} +1 -1
- package/dist/chunks/{createSession-CftIZ3aq.js → createSession-BNGm9fL4.js} +1 -1
- package/dist/chunks/createSession-VTqzWAu6.js +1 -0
- package/dist/chunks/crossProjectResume-DxgQVYSi.js +40 -0
- package/dist/chunks/{datadog-BGati3aQ.js → datadog-3WUWcCFn.js} +1 -1
- package/dist/chunks/{diff-1HsxKGBh.js → diff-CKlLimGq.js} +1 -1
- package/dist/chunks/doctor-Bvx0u0sO.js +1 -0
- package/dist/chunks/entry-DCbq734V.js +14 -0
- package/dist/chunks/{esm-BkOWaWVb.js → esm-CtQkOk5D.js} +1 -1
- package/dist/chunks/exit-DTsz5Lcb.js +1 -0
- package/dist/chunks/{extraUsage-0pUcYexI.js → extraUsage-C86bZVgt.js} +1 -1
- package/dist/chunks/extractMemories-6OnMgL2S.js +1 -0
- package/dist/chunks/fast-B2ziqJEA.js +1 -0
- package/dist/chunks/{fast-VOu2FUlV.js → fast-BkhjaTkZ.js} +1 -1
- package/dist/chunks/{fileSuggestions-Be-pyLLq.js → fileSuggestions-BalHmi1-.js} +2 -2
- package/dist/chunks/{firstPartyEventLogger-aFhcruXA.js → firstPartyEventLogger-1RTgXHSz.js} +2 -2
- package/dist/chunks/firstPartyEventLogger-CXMzhLrF.js +1 -0
- package/dist/chunks/{flushGate-BUSrMj_6.js → flushGate-DWL05x7v.js} +1 -1
- package/dist/chunks/{gemini-DB4M-MYv.js → gemini-BLpLJyli.js} +1 -1
- package/dist/chunks/generateSessionName-CdbMksHi.js +1 -0
- package/dist/chunks/goal-V3qix-i1.js +3 -0
- package/dist/chunks/grok-BLLATotv.js +1 -0
- package/dist/chunks/{grove-BnzBbGsX.js → grove-b9gGKgu4.js} +2 -2
- package/dist/chunks/{help-C5ankDi4.js → help-BR7UEr5R.js} +1 -1
- package/dist/chunks/{hooks-BZS105Rd.js → hooks-C-QMGvCg.js} +2 -2
- package/dist/chunks/hooks-D6wtd0Qq.js +1 -0
- package/dist/chunks/{initReplBridge-DL4klK0C.js → initReplBridge-DyScxedy.js} +1 -1
- package/dist/chunks/{install-NZvHd_40.js → install-DGH_bjUh.js} +1 -1
- package/dist/chunks/{instrumentation-CjBlVlFq.js → instrumentation-DQ705pC7.js} +3 -3
- package/dist/chunks/{job-D502Zf8J.js → job-BaMT6Lb2.js} +1 -1
- package/dist/chunks/keybindings-CG292HS1.js +2 -0
- package/dist/chunks/{launchLocalMemory-DxC3LojF.js → launchLocalMemory-CtZrkmaw.js} +2 -2
- package/dist/chunks/{launchOnboarding-BLp5k_H4.js → launchOnboarding-CyOtdZkT.js} +1 -1
- package/dist/chunks/loadAgentsDir-4UC4yLg1.js +1 -0
- package/dist/chunks/{loadAgentsDir-BXtV2jiO.js → loadAgentsDir-mcRW90aq.js} +389 -390
- package/dist/chunks/loadPluginHooks-CWI0RMUx.js +1 -0
- package/dist/chunks/{localSearch-CeP4ef0a.js → localSearch-CCCDKpYx.js} +1 -1
- package/dist/chunks/localSearch-D4hVR7-d.js +1 -0
- package/dist/chunks/{logoV2Utils-CEnU8qad.js → logoV2Utils--8OUQQPd.js} +1 -1
- package/dist/chunks/{magicDocs-YtfrqVC6.js → magicDocs-26J_l1De.js} +2 -2
- package/dist/chunks/main-DUjtDK1Q.js +513 -0
- package/dist/chunks/managedEnv-BuCurT_S.js +1 -0
- package/dist/chunks/{managedEnv-B-BNY0xC.js → managedEnv-Ds6MlFQE.js} +1 -1
- package/dist/chunks/{mappers-IuJeXgvr.js → mappers-DwZw084m.js} +1 -1
- package/dist/chunks/mcp-CEKR7PjL.js +6 -0
- package/dist/chunks/mcp-DCAf2hHD.js +1 -0
- package/dist/chunks/mcp-mCuc8dNe.js +2 -0
- package/dist/chunks/memory-B5SkpC7u.js +1 -0
- package/dist/chunks/{mode-GzBwK--u.js → mode-B80CHkqo.js} +2 -2
- package/dist/chunks/model-BqaneI4D.js +1 -0
- package/dist/chunks/{model-CDnVaVDR.js → model-C29_32BD.js} +1 -1
- package/dist/chunks/{model-BydaMaPr.js → model-NG8fvuT2.js} +1 -1
- package/dist/chunks/{modelOptions-ut0xePEe.js → modelOptions-CiZgZxZC.js} +1 -1
- package/dist/chunks/{nativeInstaller-fgCMR_c0.js → nativeInstaller-DqbEfGSX.js} +1 -1
- package/dist/chunks/{omit-D4Udf-p-.js → omit-KEhe84f4.js} +1 -1
- package/dist/chunks/{onChangeAppState-WbvtqDtk.js → onChangeAppState-Dq1tIEJI.js} +1 -1
- package/dist/chunks/{openai-DaVFXyBB.js → openai-BvnsYTpQ.js} +3 -3
- package/dist/chunks/{partition-CzW_31Y1.js → partition-DeT341qu.js} +1 -1
- package/dist/chunks/permissions-BPpeHxpk.js +3 -0
- package/dist/chunks/pidLock-DQGDoFQP.js +3 -0
- package/dist/chunks/{plan-M9DG3AqN.js → plan-BRiC5ujG.js} +1 -1
- package/dist/chunks/plugin-Dcg_GGR9.js +17 -0
- package/dist/chunks/{pluginAutoupdate-B5lel6s5.js → pluginAutoupdate-ByH9IPC9.js} +1 -1
- package/dist/chunks/pluginBlocklist-BfoLN9a-.js +1 -0
- package/dist/chunks/pluginCliCommands-Bc2Iybhz.js +1 -0
- package/dist/chunks/{pluginFlagging-CXSSOj4J.js → pluginFlagging-Cr0d0hBA.js} +1 -1
- package/dist/chunks/pluginOperations-CKNyYjS-.js +2 -0
- package/dist/chunks/pluginStartupCheck-B48_cGgo.js +1 -0
- package/dist/chunks/{pluginStartupCheck-BEd0VeQC.js → pluginStartupCheck-DiCDQQlr.js} +1 -1
- package/dist/chunks/plugins-BP_36tOl.js +4 -0
- package/dist/chunks/print-2uavraPq.js +26 -0
- package/dist/chunks/processBashCommand-g3sAMpHt.js +1 -0
- package/dist/chunks/processSlashCommand-tIbeCrv5.js +5 -0
- package/dist/chunks/{prompt-CRc2QEZ5.js → prompt-DIlq8NTy.js} +1 -1
- package/dist/chunks/prompt-DLv-Cd67.js +1 -0
- package/dist/chunks/prompt-DV5tCLRh.js +1 -0
- package/dist/chunks/{promptEditor-Bo1d8ZLq.js → promptEditor-BILqOGl1.js} +2 -2
- package/dist/chunks/{reconciler-BGav_ezX.js → reconciler-CDq6XgAS.js} +1 -1
- package/dist/chunks/refresh-ysrhoWCo.js +1 -0
- package/dist/chunks/{reload-plugins-DNEgQ5vo.js → reload-plugins-CGb0HTsH.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-BGOqHADF.js → remoteBridgeCore-BmteXmI9.js} +1 -1
- package/dist/chunks/{remoteManagedSettings-26nhzuca.js → remoteManagedSettings-CwDGxL5p.js} +1 -1
- package/dist/chunks/rename-1GLIUlYk.js +1 -0
- package/dist/chunks/resume-DWtlUiHW.js +2 -0
- package/dist/chunks/{runtimeObserver-BZrF3GnQ.js → runtimeObserver-4ZqaCXYy.js} +4 -4
- package/dist/chunks/{runtimeObserver-CBV-7-w7.js → runtimeObserver-CtNY8Al2.js} +1 -1
- package/dist/chunks/sandbox-adapter-BzjRQh_r.js +1 -0
- package/dist/chunks/{sandbox-toggle-D61gVqcT.js → sandbox-toggle-Bz49-F6e.js} +1 -1
- package/dist/chunks/searchExtraTools-D6vj8qJ-.js +1 -0
- package/dist/chunks/{session-Dy-_R7KP.js → session-wb6X4Wrq.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-Da97UA2n.js +1 -0
- package/dist/chunks/{sessionObserver-CyLpHSkw.js → sessionObserver-BJQ5hwjU.js} +2 -2
- package/dist/chunks/sessionObserver-DXO4trhk.js +1 -0
- package/dist/chunks/{sessionState-DSWN4tMV.js → sessionState-Bn3ESS5f.js} +1 -1
- package/dist/chunks/sessionStorage-DlPVsQn9.js +1 -0
- package/dist/chunks/{sessionTitle-L5tyJgdU.js → sessionTitle-Cbzrb9jT.js} +2 -2
- package/dist/chunks/{sessionTracing-DpHGGIZm.js → sessionTracing-CEsm8pZL.js} +1 -1
- package/dist/chunks/{settingsSync-dBqlrbcU.js → settingsSync-eHaSngKo.js} +1 -1
- package/dist/chunks/setup-DeyiuGNX.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-DZ0AA2Rw.js → shadowedRuleDetection-D5X5fhzj.js} +1 -1
- package/dist/chunks/{sideQuestion-BYT8FdPF.js → sideQuestion-BHRtwhyj.js} +3 -3
- package/dist/chunks/{sinks-mFsijQ_S.js → sinks-Bgy2UNK-.js} +2 -2
- package/dist/chunks/sinks-CgzLmim2.js +1 -0
- package/dist/chunks/skillChangeDetector-BlSP16j6.js +1 -0
- package/dist/chunks/{skillGapStore-DQXHqoP7.js → skillGapStore-BjQSSz2E.js} +2 -2
- package/dist/chunks/{skillLifecycle-BG_RnGSh.js → skillLifecycle-Sp8strFv.js} +2 -2
- package/dist/chunks/{skillSearchPanel-DxYP4Q6R.js → skillSearchPanel-3sYRez_Q.js} +4 -4
- package/dist/chunks/{skills-BD-2ofXA.js → skills-CJhWI8t1.js} +1 -1
- package/dist/chunks/{status-BmHu-c7I.js → status-CDCurOqs.js} +2 -2
- package/dist/chunks/{status-CrmnCDIE.js → status-yoQIQ2Ni.js} +1 -1
- package/dist/chunks/statusNoticeHelpers-Sl4jjauz.js +1 -0
- package/dist/chunks/switcher-C-m6MUwE.js +1 -0
- package/dist/chunks/{switcher-sYTxnJQA.js → switcher-uoQMHmEZ.js} +1 -1
- package/dist/chunks/{syncCache-BofuFJEe.js → syncCache-BooMjgU6.js} +1 -1
- package/dist/chunks/{tasks-NpI1iEem.js → tasks-CHG_6sXQ.js} +1 -1
- package/dist/chunks/teleport-C9KRE4X8.js +1 -0
- package/dist/chunks/{templateJobs-C94jEE6O.js → templateJobs-BYYfF4m5.js} +1 -1
- package/dist/chunks/{theme-CEi3b_8f.js → theme-MvX7hojJ.js} +1 -1
- package/dist/chunks/{toolEventObserver-DlL9CHmI.js → toolEventObserver-BFEl47bq.js} +1 -1
- package/dist/chunks/toolPool-Cq74Cvjp.js +1 -0
- package/dist/chunks/trustedDevice-BGwujSqc.js +1 -0
- package/dist/chunks/{trustedDevice-Bzz03jCy.js → trustedDevice-BLiKbGpG.js} +1 -1
- package/dist/chunks/{updateCCB-CzBxsuJe.js → updateCCB-CfckOy7T.js} +6 -6
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-BHQfwlAl.js → useExitOnCtrlCDWithKeybindings-CPLBDluY.js} +1 -1
- package/dist/chunks/useMainLoopModel-C00PbZ1Q.js +1 -0
- package/dist/chunks/useManagePlugins-DFaGntzJ.js +1 -0
- package/dist/chunks/{useMergedTools-CHxnwR7R.js → useMergedTools-DYobZ5N4.js} +1 -1
- package/dist/chunks/{useSearchInput-q2CFPU4W.js → useSearchInput-KFKh2ozY.js} +1 -1
- package/dist/chunks/useSettingsErrors-BRgjvaHd.js +1 -0
- package/dist/chunks/{userAgent-B7WkjI6I.js → userAgent-DUrr02yh.js} +1 -1
- package/dist/chunks/util-D7uwPgF1.js +1 -0
- package/dist/chunks/validatePlugin-VukX52bx.js +1 -0
- package/dist/chunks/{workerRegistry-Cfo7bKlm.js → workerRegistry-BA37PVbv.js} +3 -3
- package/dist/chunks/worktree-Lik8xuKd.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -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/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/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/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/RemoteSessionManager-B4jqKVd3.js +0 -2
- package/dist/chunks/ResumeConversation-B03XN_SP.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-C85Sanww.js +0 -1
- package/dist/chunks/Settings-C8GKWod1.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/api-C4VflFau.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/backgroundHousekeeping-DbpTGbwl.js +0 -1
- package/dist/chunks/backgroundHousekeeping-SpTxViUq.js +0 -17
- package/dist/chunks/bridgeConfig-Ccm79Jze.js +0 -1
- package/dist/chunks/caches-BQmbXerw.js +0 -1
- package/dist/chunks/caches-Dtjmjm6G.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-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/doctor-CJfvt9zR.js +0 -1
- package/dist/chunks/entry-CrZCZQQC.js +0 -14
- package/dist/chunks/exit-B8MA4Ltm.js +0 -1
- package/dist/chunks/extractMemories-DqhN0lba.js +0 -1
- package/dist/chunks/fast-DT5WDe3L.js +0 -1
- package/dist/chunks/firstPartyEventLogger-B8RVGBQB.js +0 -1
- package/dist/chunks/generateSessionName-DhCypqJ_.js +0 -1
- package/dist/chunks/goal-TxXtfkQ6.js +0 -3
- package/dist/chunks/grok-D2a_J5wE.js +0 -1
- package/dist/chunks/hooks-D-twhU_z.js +0 -1
- package/dist/chunks/keybindings-D9Boc8FD.js +0 -2
- package/dist/chunks/loadAgentsDir-BjsAQWqt.js +0 -1
- package/dist/chunks/loadPluginHooks-Dt3XQ-3N.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-CIvbC7rW.js +0 -1
- package/dist/chunks/parseConnectUrl-BiyKR5-x.js +0 -1
- package/dist/chunks/permissions-BT3lxYBM.js +0 -3
- package/dist/chunks/pidLock-d1VPd6CG.js +0 -3
- package/dist/chunks/plugin-BiNHuq3h.js +0 -17
- 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/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/refresh-DumNiLvM.js +0 -1
- package/dist/chunks/rename-BPknfVGF.js +0 -1
- package/dist/chunks/resume-DGz04xDh.js +0 -2
- package/dist/chunks/sandbox-adapter-DUqeqkQD.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/sessionStorage-zJ1esSCE.js +0 -1
- package/dist/chunks/setup-zf3v3ICe.js +0 -3
- package/dist/chunks/sinks-DppGvgz1.js +0 -1
- package/dist/chunks/skillChangeDetector-D-iq09Xs.js +0 -1
- package/dist/chunks/statusNoticeHelpers-DakAVtQO.js +0 -1
- package/dist/chunks/switcher-Dm646gO5.js +0 -1
- package/dist/chunks/teleport-Bs3kEipi.js +0 -1
- package/dist/chunks/toolPool-DIT_uhtD.js +0 -1
- package/dist/chunks/trustedDevice-BokywSKL.js +0 -1
- package/dist/chunks/useMainLoopModel-BkyIIW9t.js +0 -1
- package/dist/chunks/useManagePlugins-BWROoGDs.js +0 -1
- package/dist/chunks/useSettingsErrors-CPVQbsqq.js +0 -1
- package/dist/chunks/util-BfqXOA-P.js +0 -1
- package/dist/chunks/validatePlugin-jrcrYEIu.js +0 -1
- package/dist/chunks/worktree-D0k_pCEz.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{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{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,r as t}from"./firstPartyEventLogger-aFhcruXA.js";e();export{t as initialize1PEventLogging};
|
|
@@ -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,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{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,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 +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{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};
|