@readmagic/workmate 0.0.19 → 0.0.20
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-9FcHMKgX.js → AddWorkspaceDirectory-BYNvxNrD.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-BSSz86ER.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-DLnj3JQO.js → AgentsMdExternalIncludesDialog-CMEGV4Md.js} +1 -1
- package/dist/chunks/{App-NkBqbDbC.js → App-W_9d1DjK.js} +1 -1
- package/dist/chunks/{ApproveApiKey-rgB6AsYD.js → ApproveApiKey-Bf1Rb8Ql.js} +1 -1
- package/dist/chunks/ApproveApiKey-wpdvXpFr.js +1 -0
- package/dist/chunks/{BackgroundTasksDialog-CcViruUO.js → BackgroundTasksDialog-lGn1Wj1k.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-D254L98G.js → BypassPermissionsModeDialog-CjVjyNf8.js} +1 -1
- package/dist/chunks/{DiffDialog-6Srcz3NW.js → DiffDialog-DCpchgp5.js} +1 -1
- package/dist/chunks/Doctor-6SjW91rd.js +1 -0
- package/dist/chunks/{Doctor-DiNxlXfC.js → Doctor-FPYTivHw.js} +1 -1
- package/dist/chunks/{ExitFlow-Bt2De110.js → ExitFlow-Dy8_1D8J.js} +1 -1
- package/dist/chunks/{Grove-DC4jyxeB.js → Grove-Dd6rjs5P.js} +1 -1
- package/dist/chunks/{HybridTransport-DArmWb1V.js → HybridTransport-CJVkWa2u.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-DFiB0Kzc.js → InvalidConfigDialog-Bisj9ic_.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-BHNo2__T.js → InvalidSettingsDialog-DyTPNRQR.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-CdpO2Tj9.js → MCPConnectionManager-DfyoZaiu.js} +1 -1
- package/dist/chunks/{MCPToolListView-Ch4jOk_x.js → MCPToolListView-Dioupv8F.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-D4UQ8Q2e.js → McpParsingWarnings-BUlgpZAF.js} +1 -1
- package/dist/chunks/{MessageSelector-BgsrdJur.js → MessageSelector-D8fylxPg.js} +1 -1
- package/dist/chunks/{Messages-DB1pmDY_.js → Messages-BZDFMYBT.js} +1 -1
- package/dist/chunks/{Onboarding-BnjdTwci.js → Onboarding-BKLomZYo.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-Chg9U-BC.js → PromptInputFooterSuggestions-DCum89fF.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-C0ZSo12s.js → PromptInputHelpMenu-DG2lRqis.js} +1 -1
- package/dist/chunks/{QueryEngine-bKlupZpA.js → QueryEngine-CyGHpX7M.js} +1 -1
- package/dist/chunks/REPL-BDsz8KIx.js +1 -0
- package/dist/chunks/{REPL-Cg8UXYpX.js → REPL-CCBNfZfs.js} +5 -5
- package/dist/chunks/{RemoteSessionManager-CRWOHvKf.js → RemoteSessionManager-BfsOv4K6.js} +1 -1
- package/dist/chunks/{ResumeConversation-Ld7tYLKO.js → ResumeConversation-pC8NLq0F.js} +1 -1
- package/dist/chunks/{SSETransport-pPrlSZNF.js → SSETransport-B3K6eH9I.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-DYoxHo9T.js +1 -0
- package/dist/chunks/{Settings-CsOlPcIW.js → Settings-CKaGmKg2.js} +2 -2
- package/dist/chunks/{TeleportProgress-Di-PMey7.js → TeleportProgress-CkgSp1cs.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-CDv1cbo-.js → TeleportRepoMismatchDialog-DdO_rECq.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-Bmf13tGU.js → TeleportResumeWrapper-BeG4N-2z.js} +1 -1
- package/dist/chunks/{ThemePicker-B3AO3_jA.js → ThemePicker-iD9ufy99.js} +1 -1
- package/dist/chunks/{TrustDialog-C0aiR_LU.js → TrustDialog-qO5OdQt8.js} +1 -1
- package/dist/chunks/{add-dir-w1Ay3861.js → add-dir-C4eSVlZ6.js} +1 -1
- package/dist/chunks/{agentDisplay-D01ZlnVX.js → agentDisplay-BM4QG_RX.js} +1 -1
- package/dist/chunks/{agents-Bxenhf8S.js → agents-BbDBN5l9.js} +1 -1
- package/dist/chunks/{agents-B_hUgPnR.js → agents-D3APE_8d.js} +1 -1
- package/dist/chunks/{allErrors-C_iHQOlK.js → allErrors-BkgB7JNK.js} +1 -1
- package/dist/chunks/api-BHBK9axp.js +1 -0
- package/dist/chunks/{api-C5ULzZny.js → api-DyUWfg3a.js} +1 -1
- package/dist/chunks/{auth-DvcZHXGk.js → auth-0rn1U4Eq.js} +1 -1
- package/dist/chunks/auth-BEoTPSgC.js +1 -0
- package/dist/chunks/auth-BPug7U_u.js +1 -0
- package/dist/chunks/backgroundHousekeeping-D7xAhUaE.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-BGKR5cdA.js → backgroundHousekeeping-km82qEh0.js} +2 -2
- package/dist/chunks/{branch-CqQxCSHG.js → branch-CQ38cx5n.js} +1 -1
- package/dist/chunks/{bridgeConfig-MxsnEEPx.js → bridgeConfig-C5L-7KaP.js} +1 -1
- package/dist/chunks/bridgeConfig-CJMjDoaP.js +1 -0
- package/dist/chunks/{bridgeMessaging-Bx5pkkkx.js → bridgeMessaging-DVC3qj-C.js} +1 -1
- package/dist/chunks/{bridgeStatusUtil-B9EcQksI.js → bridgeStatusUtil-Cex6VowM.js} +1 -1
- package/dist/chunks/{btw-DeznoRrw.js → btw-_P96ffHR.js} +1 -1
- package/dist/chunks/caches-DH-q8Fjf.js +1 -0
- package/dist/chunks/caches-Dq0pJFDP.js +1 -0
- package/dist/chunks/{ccrClient-CimQTd0b.js → ccrClient-DO563xlf.js} +1 -1
- package/dist/chunks/{clear-KvoD-lFN.js → clear-DmqQBNKg.js} +1 -1
- package/dist/chunks/client-C19cqYQS.js +1 -0
- package/dist/chunks/commands-BkpqHY9F.js +1 -0
- package/dist/chunks/{compact-Dgzve3dI.js → compact-DuVIvqMu.js} +1 -1
- package/dist/chunks/config-DMP6-Ccr.js +1 -0
- package/dist/chunks/{context-Dz-bbYCw.js → context-DjgMzIfe.js} +1 -1
- package/dist/chunks/{context-noninteractive-ApbVPU86.js → context-noninteractive-BzDVMnWC.js} +1 -1
- package/dist/chunks/context-noninteractive-DV7bIJCm.js +1 -0
- package/dist/chunks/{conversation-CJ-d0O-U.js → conversation-BBOE_EoE.js} +1 -1
- package/dist/chunks/conversation-WxH5pb2z.js +1 -0
- package/dist/chunks/{createSSHSession-DOz_Ox1_.js → createSSHSession-LVGVXHXL.js} +1 -1
- package/dist/chunks/createSession-BUzna9-E.js +1 -0
- package/dist/chunks/{createSession-yR87Rhiv.js → createSession-Dgwxk1WA.js} +1 -1
- package/dist/chunks/{crossProjectResume-DNnZo3gU.js → crossProjectResume-6B2NYy8a.js} +1 -1
- package/dist/chunks/{datadog-DBgIEaEd.js → datadog-Bc6wkPne.js} +1 -1
- package/dist/chunks/{diff-qOom_T1G.js → diff-DIg66U_d.js} +1 -1
- package/dist/chunks/doctor-BhUmhHQU.js +1 -0
- package/dist/chunks/{entry-EmOA7oWN.js → entry-B-Y-AYeK.js} +1 -1
- package/dist/chunks/{esm-DBMVQDVv.js → esm-CvHtYRrr.js} +1 -1
- package/dist/chunks/{exit-DDrAFCzE.js → exit-CW2eqUrR.js} +1 -1
- package/dist/chunks/{extraUsage-DylXI7Fc.js → extraUsage-CkTon7ib.js} +1 -1
- package/dist/chunks/extractMemories-CfmbvayQ.js +1 -0
- package/dist/chunks/fast-ByahC7Gw.js +1 -0
- package/dist/chunks/{fast-BCkhj9Dq.js → fast-xtIP4u4y.js} +1 -1
- package/dist/chunks/fetchModelList-D9aePIPW.js +1 -0
- package/dist/chunks/{fetchModelList-BbjuFHQT.js → fetchModelList-Dy-x4h3G.js} +1 -1
- package/dist/chunks/{fileSuggestions-Ct7vKEpR.js → fileSuggestions-CFkJktgc.js} +1 -1
- package/dist/chunks/firstPartyEventLogger-Bt9iG9xk.js +1 -0
- package/dist/chunks/{firstPartyEventLogger-CxUuXQhL.js → firstPartyEventLogger-DqGSujCz.js} +2 -2
- package/dist/chunks/{flushGate-BZe_QwEz.js → flushGate-BjKW7PFC.js} +1 -1
- package/dist/chunks/{gemini-8sSwOtEf.js → gemini-NnmxBoEp.js} +1 -1
- package/dist/chunks/{generateSessionName-vT1khubt.js → generateSessionName-EpqGW-T2.js} +1 -1
- package/dist/chunks/{goal-CznQA1n1.js → goal-DbS8yJfB.js} +1 -1
- package/dist/chunks/{grok-cEzUsG-s.js → grok-BxZ4vTDw.js} +1 -1
- package/dist/chunks/{grove--HtQL4QZ.js → grove-CYE1Cfcz.js} +1 -1
- package/dist/chunks/{help-B6A_kDQA.js → help-DatnwM25.js} +1 -1
- package/dist/chunks/{hooks-CN5hLrhi.js → hooks-7iyENdDG.js} +1 -1
- package/dist/chunks/hooks-DjbqtbUV.js +1 -0
- package/dist/chunks/{initReplBridge-BJhmlcVt.js → initReplBridge-BEZW5PEY.js} +1 -1
- package/dist/chunks/{install-DUOtI2Hq.js → install-DJukI-kL.js} +1 -1
- package/dist/chunks/{instrumentation-DpgB3GFx.js → instrumentation-2HH15DPu.js} +3 -3
- package/dist/chunks/{job-DDoX1iFe.js → job-CXz7SLZp.js} +1 -1
- package/dist/chunks/{keybindings-BGTuYfk-.js → keybindings-C9l5il16.js} +1 -1
- package/dist/chunks/{launchLocalMemory-CoWeLNeP.js → launchLocalMemory-BfGenqj1.js} +1 -1
- package/dist/chunks/{launchOnboarding-CTIBGSLV.js → launchOnboarding-DjMmXeQE.js} +1 -1
- package/dist/chunks/{loadAgentsDir-DXOkUcW3.js → loadAgentsDir-DaNpxaO-.js} +587 -612
- package/dist/chunks/loadAgentsDir-DcI-8FQF.js +1 -0
- package/dist/chunks/{loadPluginHooks-DrNVtTBq.js → loadPluginHooks-CGgpcyEC.js} +1 -1
- package/dist/chunks/{localSearch-DnT21UkF.js → localSearch-C2SZ9bGW.js} +1 -1
- package/dist/chunks/localSearch-CTTwYTU1.js +1 -0
- package/dist/chunks/{logoUtils-YwL3izJt.js → logoUtils-CbIqOFrX.js} +1 -1
- package/dist/chunks/{magicDocs-rxv0rR8E.js → magicDocs-CrTwULyJ.js} +1 -1
- package/dist/chunks/{main-BOvY4O6D.js → main-bJXadFi0.js} +10 -10
- package/dist/chunks/{managedEnv-CpgCYISH.js → managedEnv-CUsdYhAI.js} +1 -1
- package/dist/chunks/managedEnv-DXeaUDSK.js +1 -0
- package/dist/chunks/{mappers-DYtq2XVS.js → mappers-_B-s9fNz.js} +1 -1
- package/dist/chunks/{mcp-BoU3TNFs.js → mcp-BbbYzWpy.js} +2 -2
- package/dist/chunks/{mcp-BPvcoKDY.js → mcp-D91sH9a8.js} +1 -1
- package/dist/chunks/{mcp-BfqsHRx0.js → mcp-Dx-zgUgu.js} +1 -1
- package/dist/chunks/{memory-BPKRdkBb.js → memory-BeL7ui9m.js} +1 -1
- package/dist/chunks/{mode-CXpXux2s.js → mode-D695kgLI.js} +1 -1
- package/dist/chunks/model-DX0TtzqX.js +1 -0
- package/dist/chunks/{model-Cxx3suBa.js → model-Do0f476p.js} +1 -1
- package/dist/chunks/{model-CxPYKiW1.js → model-DpcM8dz5.js} +1 -1
- package/dist/chunks/{modelOptions-BqBHEyiR.js → modelOptions-B3nis9cC.js} +1 -1
- package/dist/chunks/{src-l6_O0K-a.js → modifiersNative-BYHdmWw1.js} +1 -1
- package/dist/chunks/modifiersNative-D7nm70eq.js +1 -0
- package/dist/chunks/{nativeInstaller-CaXwRpoR.js → nativeInstaller-CymO8TNe.js} +1 -1
- package/dist/chunks/{omit-DZUxsClb.js → omit-DO61BHZu.js} +1 -1
- package/dist/chunks/{onChangeAppState-qHXqufwy.js → onChangeAppState-vKml_lit.js} +1 -1
- package/dist/chunks/{openai-_FQ9EhuR.js → openai-DdupGVdC.js} +1 -1
- package/dist/chunks/{partition-BgwHlPsO.js → partition-BivH9MBJ.js} +1 -1
- package/dist/chunks/{permissions-Dv5d5Nu3.js → permissions-C9iqR4_N.js} +1 -1
- package/dist/chunks/{pidLock-CEhbTkBE.js → pidLock-DiKz5Tza.js} +2 -2
- package/dist/chunks/{plan-DVPBW5OS.js → plan-KDN5IGWY.js} +1 -1
- package/dist/chunks/{plugin-Bh2eBwLW.js → plugin-D0rzUb8E.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-C2YbEHrP.js → pluginAutoupdate-C2xTKLR_.js} +1 -1
- package/dist/chunks/{pluginBlocklist-B2NAKaB9.js → pluginBlocklist-xdiUmUpt.js} +1 -1
- package/dist/chunks/{pluginCliCommands-Cw5TrYYb.js → pluginCliCommands-CIDDvVN7.js} +1 -1
- package/dist/chunks/{pluginFlagging-BDTgCYuC.js → pluginFlagging-DRA0m76J.js} +1 -1
- package/dist/chunks/{pluginOperations-BBwGEdfC.js → pluginOperations-BEYsarAn.js} +1 -1
- package/dist/chunks/{pluginStartupCheck-DhhMk3dA.js → pluginStartupCheck-BF1N4Lih.js} +1 -1
- package/dist/chunks/pluginStartupCheck-DVkI4pqo.js +1 -0
- package/dist/chunks/{plugins-r0h93GT_.js → plugins-CWWU4BKs.js} +1 -1
- package/dist/chunks/{print-CDzhHi2F.js → print-B5H2xbBS.js} +3 -3
- package/dist/chunks/{processBashCommand-DmdCAWOR.js → processBashCommand-EQ9EWaRV.js} +1 -1
- package/dist/chunks/{processSlashCommand-B43TkiaI.js → processSlashCommand-C4PKNyFT.js} +1 -1
- package/dist/chunks/{prompt-DEioJrx_.js → prompt-8u06WVES.js} +1 -1
- package/dist/chunks/prompt-B9sDzLPK.js +1 -0
- package/dist/chunks/prompt-WsoTRhoh.js +1 -0
- package/dist/chunks/{promptEditor-eJzbtNn4.js → promptEditor-Cr4w-4Bz.js} +1 -1
- package/dist/chunks/{protocolHandler-C-CFTcUJ.js → protocolHandler-DzHVaPl3.js} +2 -2
- package/dist/chunks/{reconciler-DZP4dJJG.js → reconciler-RIKmaPg7.js} +1 -1
- package/dist/chunks/{refresh-vaY-Sr80.js → refresh-CCSCAjgz.js} +1 -1
- package/dist/chunks/registerProtocol-C0IlPEoa.js +1 -0
- package/dist/chunks/{reload-plugins-m9CzoIxu.js → reload-plugins-DC-tbXVv.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-C4vSr1gp.js → remoteBridgeCore-NGTnhQgw.js} +1 -1
- package/dist/chunks/{remoteManagedSettings-6RAHPt_g.js → remoteManagedSettings-BoOYHzYP.js} +1 -1
- package/dist/chunks/{rename-DmauGVBX.js → rename-DS1AmW-F.js} +1 -1
- package/dist/chunks/{resume-ut_pBrLN.js → resume-Cf5PSoPw.js} +1 -1
- package/dist/chunks/{runtimeObserver-CSroopId.js → runtimeObserver-DzesbvgI.js} +1 -1
- package/dist/chunks/{runtimeObserver-C2vjqtCE.js → runtimeObserver-L6041elO.js} +2 -2
- package/dist/chunks/sandbox-adapter-Z4Phj31K.js +1 -0
- package/dist/chunks/{sandbox-toggle-BJKd1ZYk.js → sandbox-toggle-COZE8Lo4.js} +1 -1
- package/dist/chunks/sanitization-DV-94a9Z.js +1 -0
- package/dist/chunks/searchExtraTools-CvkRbL2m.js +1 -0
- package/dist/chunks/{session-DTin6hOR.js → session-BvA99K4j.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-6XfAf6ke.js +1 -0
- package/dist/chunks/{sessionObserver-iAJLH92a.js → sessionObserver-0D8xFoRK.js} +1 -1
- package/dist/chunks/sessionObserver-CRWUBJEY.js +1 -0
- package/dist/chunks/{sessionState-DAcub-HK.js → sessionState-CQhbGfmh.js} +1 -1
- package/dist/chunks/sessionStorage-DqEuxDlb.js +1 -0
- package/dist/chunks/{sessionTracing-Dvi520eN.js → sessionTracing-BoOZsXU2.js} +1 -1
- package/dist/chunks/{settingsSync-aHn3p-6J.js → settingsSync-rkWmClKS.js} +1 -1
- package/dist/chunks/{setup-CK3ybjjM.js → setup-D8L275fT.js} +2 -2
- package/dist/chunks/{shadowedRuleDetection-BL7dEv-u.js → shadowedRuleDetection-Cy9tsuKc.js} +1 -1
- package/dist/chunks/{sideQuestion-Ct87yvOR.js → sideQuestion-Ds7Elgs4.js} +1 -1
- package/dist/chunks/{sinks-Bmn3li0M.js → sinks-BXX72cbf.js} +1 -1
- package/dist/chunks/sinks-DMp6uEzM.js +1 -0
- package/dist/chunks/{skillChangeDetector-Bco3UoeW.js → skillChangeDetector-CtithJ4a.js} +1 -1
- package/dist/chunks/{skillGapStore-MtlRyYmT.js → skillGapStore-BxCxKPev.js} +2 -2
- package/dist/chunks/{skillLifecycle-Drs6gEv9.js → skillLifecycle-CfyNC3sW.js} +2 -2
- package/dist/chunks/{skillSearchPanel-DkvmjNaw.js → skillSearchPanel-CMNJFIEC.js} +2 -2
- package/dist/chunks/{skills-axToWEo0.js → skills-DXMk-498.js} +1 -1
- package/dist/chunks/{status-CGp4uRlH.js → status-CFrLuGbf.js} +1 -1
- package/dist/chunks/status-D5OCkMZG.js +1 -0
- package/dist/chunks/{statusNoticeHelpers-BrN_2q7H.js → statusNoticeHelpers-CZoOse-_.js} +1 -1
- package/dist/chunks/switcher-AiMcRzoi.js +1 -0
- package/dist/chunks/{switcher-99gm2vpe.js → switcher-DQF5ZNal.js} +1 -1
- package/dist/chunks/{syncCache-B3OVvp8K.js → syncCache-qWJ_VfBo.js} +1 -1
- package/dist/chunks/{tasks-t5zT_D32.js → tasks-C8pb6ftc.js} +1 -1
- package/dist/chunks/{teleport-CvX_nUjQ.js → teleport-Bi_1VFIZ.js} +1 -1
- package/dist/chunks/{templateJobs-Bm8bovHx.js → templateJobs-DJ4dcfcL.js} +1 -1
- package/dist/chunks/{theme-DzaSXOpQ.js → theme-CEKOCSLw.js} +1 -1
- package/dist/chunks/{toolEventObserver-C_nHI27x.js → toolEventObserver-D2nk8ZbW.js} +1 -1
- package/dist/chunks/{toolPool-CgKK0K8f.js → toolPool-Df5iUqJ-.js} +1 -1
- package/dist/chunks/{trustedDevice-Bb7O8_tj.js → trustedDevice-CB6rNzl-.js} +1 -1
- package/dist/chunks/trustedDevice-DXGePUAC.js +1 -0
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-D0uqGxGw.js → useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js} +1 -1
- package/dist/chunks/useMainLoopModel-CIG2cjS2.js +1 -0
- package/dist/chunks/{useManagePlugins-ITVFO9dz.js → useManagePlugins-MSHw-qHx.js} +1 -1
- package/dist/chunks/{useMergedTools-rQ19rFvH.js → useMergedTools-Bb-INJa2.js} +1 -1
- package/dist/chunks/{useSearchInput-CXTa-leH.js → useSearchInput-QL_VtdJD.js} +1 -1
- package/dist/chunks/{useSettingsErrors-Xc6RYjYF.js → useSettingsErrors-Dvi6zLCr.js} +1 -1
- package/dist/chunks/{userAgent-CJ5Rp9kc.js → userAgent-i-oGzf40.js} +1 -1
- package/dist/chunks/{util-CD3ar4of.js → util-CLQvtXuD.js} +1 -1
- package/dist/chunks/{validatePlugin-CxrlCKc1.js → validatePlugin-1mTZ3TJR.js} +1 -1
- package/dist/chunks/{workerRegistry-BGJtgrko.js → workerRegistry-BjxoZ12l.js} +2 -2
- package/dist/chunks/worktree-DpksgxdF.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -5
- package/dist/chunks/AgentsMdExternalIncludesDialog-Bny8WDwC.js +0 -1
- package/dist/chunks/ApproveApiKey-BKzkEkW-.js +0 -1
- package/dist/chunks/Doctor-DYEdLRxR.js +0 -1
- package/dist/chunks/REPL-yzvMFfaU.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-CdgQlm--.js +0 -1
- package/dist/chunks/api-CB3e0De0.js +0 -1
- package/dist/chunks/attributionHooks-C0aXyx9L.js +0 -1
- package/dist/chunks/auth-CsYEYXBO.js +0 -1
- package/dist/chunks/auth-CubXYcRl.js +0 -1
- package/dist/chunks/backgroundHousekeeping-CykbtljP.js +0 -1
- package/dist/chunks/bridgeConfig-Cp2x_wtE.js +0 -1
- package/dist/chunks/caches-BiVRgePi.js +0 -1
- package/dist/chunks/caches-CGzKSWiP.js +0 -1
- package/dist/chunks/client-CmnPWgLq.js +0 -1
- package/dist/chunks/commands-CrzVgHxp.js +0 -1
- package/dist/chunks/config-Df8jooTW.js +0 -1
- package/dist/chunks/context-noninteractive-m4O3VtG7.js +0 -1
- package/dist/chunks/conversation-BYBX07j8.js +0 -1
- package/dist/chunks/createSession-C_-ZEQT5.js +0 -1
- package/dist/chunks/doctor-CflXjqVK.js +0 -1
- package/dist/chunks/extractMemories-B_8wZpXA.js +0 -1
- package/dist/chunks/fast-4ajfJv-M.js +0 -1
- package/dist/chunks/fetchModelList-V8_e2O1N.js +0 -1
- package/dist/chunks/firstPartyEventLogger-YQm0DoVu.js +0 -1
- package/dist/chunks/hooks-CJY5Vfy6.js +0 -1
- package/dist/chunks/loadAgentsDir-Dxz1vp3F.js +0 -1
- package/dist/chunks/localSearch-CCs5fOd_.js +0 -1
- package/dist/chunks/managedEnv-CrnBYTtQ.js +0 -1
- package/dist/chunks/model-aEJ54cMA.js +0 -1
- package/dist/chunks/pluginStartupCheck-CHx379_R.js +0 -1
- package/dist/chunks/postCommitAttribution-DoSP9wZD.js +0 -1
- package/dist/chunks/prompt-C50mDqWv.js +0 -1
- package/dist/chunks/prompt-WGH9CcXh.js +0 -1
- package/dist/chunks/registerProtocol-Xsq4ldwg.js +0 -1
- package/dist/chunks/sandbox-adapter-CL0qdcxn.js +0 -1
- package/dist/chunks/searchExtraTools-ByWuNCGo.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-DorzHolr.js +0 -1
- package/dist/chunks/sessionObserver-Dy6NFlzL.js +0 -1
- package/dist/chunks/sessionStorage-DItJMkwx.js +0 -1
- package/dist/chunks/sinks-QQ_6Op7q.js +0 -1
- package/dist/chunks/src-DPUAq5Ty.js +0 -1
- package/dist/chunks/status-3uevwSMo.js +0 -1
- package/dist/chunks/switcher-DJDxjLPQ.js +0 -1
- package/dist/chunks/trustedDevice-C2gnF9Lc.js +0 -1
- package/dist/chunks/useMainLoopModel-BGPOmBkl.js +0 -1
- package/dist/chunks/worktree-CanG5GhE.js +0 -1
- /package/dist/chunks/{src-DLz3FZm1.js → urlHandler-DLz3FZm1.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$u as i,Dp as a,F as o,N as s,Op as c,P as l,Qu as u,cd as d,ld as f,uC as p}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$u as i,Dp as a,F as o,N as s,Op as c,P as l,Qu as u,cd as d,ld as f,uC as p}from"./loadAgentsDir-DaNpxaO-.js";import{D as m,I as h,P as g,T as _,Wt as v,ai as y,t as b,vn as x,y as S,yn as C}from"./src-DL3w8VPk2.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{r as T,t as E}from"./directoryCompletion-BDGcGDuv.js";import{r as D,t as O}from"./PromptInputFooterSuggestions-DCum89fF.js";function k(){return(0,P.jsx)(g,{dimColor:!0,children:`Work Mate will be able to read files in this directory and make edits when auto-accept edits is on.`})}function A({path:e}){return(0,P.jsxs)(h,{flexDirection:`column`,paddingX:2,gap:1,children:[(0,P.jsx)(g,{color:`permission`,children:e}),(0,P.jsx)(k,{})]})}function j({value:e,onChange:t,onSubmit:n,error:i,suggestions:a,selectedSuggestion:o}){return(0,P.jsxs)(h,{flexDirection:`column`,children:[(0,P.jsx)(g,{children:`Enter the path to the directory:`}),(0,P.jsx)(h,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,P.jsx)(d,{showCursor:!0,placeholder:`Directory path${r.ellipsis}`,value:e,onChange:t,onSubmit:n,columns:80,cursorOffset:e.length,onChangeCursorOffset:()=>{}})}),a.length>0&&(0,P.jsx)(h,{marginBottom:1,children:(0,P.jsx)(O,{suggestions:a,selectedSuggestion:o})}),i&&(0,P.jsx)(g,{color:`error`,children:i})]})}function M({onAddDirectory:e,onCancel:t,permissionContext:n,directoryPath:r}){let[i,c]=(0,N.useState)(``),[l,d]=(0,N.useState)(null),[f,p]=(0,N.useState)([]),[y,b]=(0,N.useState)(0),x=(0,N.useMemo)(()=>F,[]),w=C((0,N.useCallback)(async e=>{if(!e){p([]),b(0);return}let t=await E(e);p(t),b(0)},[]),100);(0,N.useEffect)(()=>{w(i)},[i,w]);let T=(0,N.useCallback)(e=>{let t=`${e.id}/`;c(t),d(null)},[]),D=(0,N.useCallback)(async t=>{let r=await o(t,n);r.resultType===`success`?e(r.absolutePath,!1):d(s(r))},[n,e]);v(`confirm:no`,t,{context:`Settings`});let O=(0,N.useCallback)(e=>{if(f.length>0){if(e.key===`tab`){e.preventDefault();let t=f[y];t&&T(t);return}if(e.key===`return`){e.preventDefault();let t=f[y];t&&D(`${t.id}/`);return}if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),b(e=>e<=0?f.length-1:e-1);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),b(e=>e>=f.length-1?0:e+1);return}}},[f,y,T,D]),M=(0,N.useCallback)(n=>{if(r)switch(n){case`yes-session`:e(r,!1);break;case`yes-remember`:e(r,!0);break;case`no`:t();break}},[r,e,t]);return(0,P.jsx)(h,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:O,children:(0,P.jsx)(S,{title:`Add directory to workspace`,onCancel:t,color:`permission`,isCancelActive:!1,inputGuide:r?void 0:e=>e.pending?(0,P.jsxs)(g,{children:[`Press `,e.keyName,` again to exit`]}):(0,P.jsxs)(_,{children:[(0,P.jsx)(m,{shortcut:`Tab`,action:`complete`}),(0,P.jsx)(m,{shortcut:`Enter`,action:`add`}),(0,P.jsx)(a,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]}),children:r?(0,P.jsxs)(h,{flexDirection:`column`,gap:1,children:[(0,P.jsx)(A,{path:r}),(0,P.jsx)(u,{options:x,onChange:M,onCancel:()=>M(`no`)})]}):(0,P.jsxs)(h,{flexDirection:`column`,gap:1,marginX:2,children:[(0,P.jsx)(k,{}),(0,P.jsx)(j,{value:i,onChange:c,onSubmit:D,error:l,suggestions:f,selectedSuggestion:y})]})})})}var N,P,F,I=e((()=>{n(),N=t(y(),1),x(),l(),f(),b(),p(),T(),c(),i(),D(),P=w(),F=[{value:`yes-session`,label:`Yes, for this session`},{value:`yes-remember`,label:`Yes, and remember this directory`},{value:`no`,label:`No`}]}));export{I as n,M as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./AgentsMdExternalIncludesDialog-CMEGV4Md.js";e();export{t as AgentsMdExternalIncludesDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Qu as n,Zu as r}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Qu as n,Zu as r}from"./loadAgentsDir-DaNpxaO-.js";import{I as i,Lt as a,P as o,ai as s,t as c,y as l}from"./src-DL3w8VPk2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{h as d,v as f}from"./config-DRy1I12M.js";import{n as p,r as m}from"./analytics-DJobLaWP.js";function h({onDone:e,isStandaloneDialog:t,externalIncludes:r}){g.useEffect(()=>{m(`tengu_claude_md_includes_dialog_shown`,{})},[]);let s=(0,g.useCallback)(t=>{t===`no`?(m(`tengu_claude_md_external_includes_dialog_declined`,{}),f(e=>({...e,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!0}))):(m(`tengu_claude_md_external_includes_dialog_accepted`,{}),f(e=>({...e,hasAgentsMdExternalIncludesApproved:!0,hasAgentsMdExternalIncludesWarningShown:!0}))),e()},[e]);return(0,_.jsxs)(l,{title:`Allow external AGENTS.md file imports?`,color:`warning`,onCancel:(0,g.useCallback)(()=>{s(`no`)},[s]),hideBorder:!t,hideInputGuide:!t,children:[(0,_.jsx)(o,{children:`This project's AGENTS.md imports files outside the current working directory. Never allow this for third-party repositories.`}),r&&r.length>0&&(0,_.jsxs)(i,{flexDirection:`column`,children:[(0,_.jsx)(o,{dimColor:!0,children:`External imports:`}),r.map((e,t)=>(0,_.jsxs)(o,{dimColor:!0,children:[` `,e.path]},t))]}),(0,_.jsxs)(o,{dimColor:!0,children:[`Important: Only use Work Mate with files you trust. Accessing untrusted files may pose security risks`,` `,(0,_.jsx)(a,{url:`https://code.workmate.com/docs/en/security`}),` `]}),(0,_.jsx)(n,{options:[{label:`Yes, allow external imports`,value:`yes`},{label:`No, disable external imports`,value:`no`}],onChange:e=>s(e)})]})}var g,_,v=e((()=>{g=t(s(),1),p(),c(),d(),r(),_=u()}));export{v as n,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Xh as e,Yh as t}from"./loadAgentsDir-
|
|
1
|
+
import{Xh as e,Yh as t}from"./loadAgentsDir-DaNpxaO-.js";import{R as n,t as r}from"./src-DL3w8VPk2.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{c as a,h as o,y as s}from"./config-DRy1I12M.js";import{n as c}from"./onChangeAppState-vKml_lit.js";import{t as l}from"./fpsMetrics-Dk_pnSHJ.js";import{t as u}from"./stats-Ce15gc3E.js";e(),r(),o();var d=i();function f({getFpsMetrics:e,stats:r,initialState:i,children:o}){return(0,d.jsx)(l,{getFpsMetrics:e,children:(0,d.jsx)(u,{store:r,children:(0,d.jsx)(t,{initialState:i,onChangeAppState:c,children:(0,d.jsx)(n,{initialState:a().theme,onThemeSave:e=>s(t=>({...t,theme:e})),children:o})})})})}export{f as App};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Qu as e,Zu as t}from"./loadAgentsDir-
|
|
1
|
+
import{Qu as e,Zu as t}from"./loadAgentsDir-DaNpxaO-.js";import{P as n,t as r,y as i}from"./src-DL3w8VPk2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{h as o,y as s}from"./config-DRy1I12M.js";r(),o(),t();var c=a();function l({customApiKeyTruncated:t,onDone:r}){function a(e){switch(e){case`yes`:s(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,approved:[...e.customApiKeyResponses?.approved??[],t]}})),r(!0);break;case`no`:s(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,rejected:[...e.customApiKeyResponses?.rejected??[],t]}})),r(!1);break}}return(0,c.jsxs)(i,{title:`Detected a custom API key in your environment`,color:`warning`,onCancel:()=>a(`no`),children:[(0,c.jsxs)(n,{children:[(0,c.jsx)(n,{bold:!0,children:`ANTHROPIC_API_KEY`}),(0,c.jsxs)(n,{children:[`: sk-ant-...`,t]})]}),(0,c.jsx)(n,{children:`Do you want to use this API key?`}),(0,c.jsx)(e,{defaultValue:`no`,defaultFocusValue:`no`,options:[{label:`Yes`,value:`yes`},{label:(0,c.jsxs)(n,{children:[`No (`,(0,c.jsx)(n,{bold:!0,children:`recommended`}),`)`]}),value:`no`}],onChange:e=>a(e),onCancel:()=>a(`no`)})]})}export{l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./ApproveApiKey-Bf1Rb8Ql.js";export{e as ApproveApiKey};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$h as i,$u as a,Af as o,Ag as s,Dg as c,En as l,Ga as u,If as d,Is as f,Jh as p,Kc as m,La as h,Lf as g,Ls as _,Mf as v,On as y,Qu as b,Xh as ee,Zh as te,ad as ne,au as x,dC as S,df as re,dp as ie,eS as ae,ea as oe,fC as se,fp as ce,gC as C,iu as w,lu as T,nd as E,nu as le,op as ue,pu as de,qc as fe,qh as pe,ru as me,sp as he,tS as ge,tu as _e,uC as ve,uf as ye,wa as be}from"./loadAgentsDir-DXOkUcW3.js";import{D,Gt as O,H as xe,I as k,Lt as Se,P as A,T as j,ai as M,mt as Ce,ot as we,t as N,y as P}from"./src-DL3w8VPk2.js";import{t as F}from"./jsx-runtime-Bb4Xn-E0.js";import{P as Te,R as Ee,_ as De,f as Oe}from"./debug-D58GQBDG.js";import{In as ke,Ln as Ae,Rn as je,Ut as Me}from"./settings-3xZ0fsvE.js";import{C as Ne,b as I,f as Pe,l as Fe,u as Ie,v as L}from"./startupProfiler-CbzxVmbv.js";import{l as R,o as Le}from"./stringUtils-CKD8qDqx.js";import{Nt as Re,_n as ze,gn as Be,vn as Ve}from"./prompt-DEioJrx_.js";import{i as He,n as Ue}from"./mappers-DYtq2XVS.js";function z(e,t,n=1e3,r=0,i){let a=()=>Fe(Math.max(0,(i??Date.now())-e-r));return(0,We.useSyncExternalStore)((0,We.useCallback)(e=>{if(!t)return()=>{};let r=setInterval(e,n);return()=>clearInterval(r)},[t,n]),a,a)}var We,B=e((()=>{We=t(M(),1),L()}));function Ge(e,t,n){let r=Be(t,e.toolName);if(!r)return e.toolName;try{let t=r.inputSchema.safeParse(e.input),i=t.success?t.data:{},a=r.userFacingName(i);if(!a)return e.toolName;let o=r.renderToolUseMessage(i,{theme:n,verbose:!1});return o?(0,Ke.jsxs)(A,{children:[a,`(`,o,`)`]}):a}catch{return e.toolName}}var Ke,qe=e((()=>{N(),Ve(),Ke=F()}));function Je(e,t){let{isIdle:n,awaitingApproval:i,hasError:a,shutdownRequested:o}=t??{};return a?r.cross:i?r.questionMarkPrefix:o?r.warning:e===`running`?n?r.ellipsis:r.play:e===`completed`?r.tick:e===`failed`||e===`killed`?r.cross:r.bullet}function Ye(e,t){let{isIdle:n,awaitingApproval:r,hasError:i,shutdownRequested:a}=t??{};return i?`error`:r||a?`warning`:n?`background`:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:`background`}function Xe(e,t){if(!t)return!1;let n=!1;for(let t of Object.values(e))if(g(t))return n=!0,!1;return n}var Ze=e((()=>{n(),d()}));function Qe({agent:e,onDone:t,onKillAgent:n,onBack:r}){let[i]=xe(),a=(0,$e.useMemo)(()=>m(ze()),[]),o=z(e.startTime,e.status===`running`,1e3,e.totalPausedMs??0);O({"confirm:yes":t},{context:`Confirmation`});let s=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},c=be(e.prompt,`plan`),l=e.prompt.length>300?`${e.prompt.substring(0,297)}…`:e.prompt,u=e.result?.totalTokens??e.progress?.tokenCount,d=e.result?.totalToolUseCount??e.progress?.toolUseCount;return(0,V.jsx)(k,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:s,children:(0,V.jsx)(P,{title:(0,V.jsxs)(A,{children:[e.selectedAgent?.agentType??`agent`,` › `,e.description||`Async agent`]}),subtitle:(0,V.jsxs)(A,{children:[e.status!==`running`&&(0,V.jsxs)(A,{color:Ye(e.status),children:[Je(e.status),` `,e.status===`completed`?`Completed`:e.status===`failed`?`Failed`:`Stopped`,` · `]}),(0,V.jsxs)(A,{dimColor:!0,children:[o,u!==void 0&&u>0&&(0,V.jsxs)(V.Fragment,{children:[` · `,Pe(u),` tokens`]}),d!==void 0&&d>0&&(0,V.jsxs)(V.Fragment,{children:[` `,`· `,d,` `,d===1?`tool`:`tools`]})]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,V.jsxs)(A,{children:[`Press `,t.keyName,` again to exit`]}):(0,V.jsxs)(j,{children:[r&&(0,V.jsx)(D,{shortcut:`←`,action:`go back`}),(0,V.jsx)(D,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,V.jsx)(D,{shortcut:`x`,action:`stop`})]}),children:(0,V.jsxs)(k,{flexDirection:`column`,children:[e.status===`running`&&e.progress?.recentActivities&&e.progress.recentActivities.length>0&&(0,V.jsxs)(k,{flexDirection:`column`,children:[(0,V.jsx)(A,{bold:!0,dimColor:!0,children:`Progress`}),e.progress.recentActivities.map((t,n)=>(0,V.jsxs)(A,{dimColor:n<e.progress.recentActivities.length-1,wrap:`truncate-end`,children:[n===e.progress.recentActivities.length-1?`› `:` `,Ge(t,a,i)]},n))]}),c?(0,V.jsx)(k,{marginTop:1,children:(0,V.jsx)(ie,{addMargin:!1,planContent:c})}):(0,V.jsxs)(k,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(A,{bold:!0,dimColor:!0,children:`Prompt`}),(0,V.jsx)(A,{wrap:`wrap`,children:l})]}),e.status===`failed`&&e.error&&(0,V.jsxs)(k,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(A,{bold:!0,color:`error`,children:`Error`}),(0,V.jsx)(A,{color:`error`,wrap:`wrap`,children:e.error})]})]})})})}var $e,V,et=e((()=>{$e=t(M(),1),B(),N(),ve(),Ve(),fe(),L(),h(),ce(),qe(),Ze(),V=F()}));function tt(e,t,n,r){if(!e)return`${t} found · ${n} verified`;if(e===`synthesizing`){let e=[`${n} verified`];return r>0&&e.push(`${r} refuted`),e.push(`deduping`),e.join(` · `)}if(e===`verifying`){let e=[`${t} found`,`${n} verified`];return r>0&&e.push(`${r} refuted`),e.join(` · `)}return t>0?`${t} found`:`finding`}function nt({text:e,phase:t=0}){return(0,H.jsx)(H.Fragment,{children:[...e].map((e,n)=>(0,H.jsx)(A,{color:ue(n+t),children:e},n))})}function rt(e,t,n){let r=(0,ot.useRef)(e),i=(0,ot.useRef)(t);return n||e<r.current?r.current=e:e>r.current&&t!==i.current&&(r.current+=1,i.current=t),r.current}function it({session:e}){let t=p().prefersReducedMotion??!1,n=e.reviewProgress,r=e.status===`running`,[,i]=Ce(r&&!t?st:null),a=n?.bugsFound??0,o=n?.bugsVerified??0,s=n?.bugsRefuted??0,c=t||!r,l=rt(a,i,c),u=rt(o,i,c),d=rt(s,i,c),f=Math.floor(i/(st*3))%7;if(e.status===`completed`)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(A,{color:`background`,children:[`◆`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:0}),(0,H.jsx)(A,{dimColor:!0,children:` ready · shift+↓ to view`})]});if(e.status===`failed`)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(A,{color:`background`,children:[`◆`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:0}),(0,H.jsxs)(A,{color:`error`,dimColor:!0,children:[` · `,`error`]})]});let m=n?tt(n.stage,l,u,d):`setting up`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(A,{color:`background`,children:[`◇`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:r?f:0}),(0,H.jsxs)(A,{dimColor:!0,children:[` · `,m]})]})}function at({session:e}){if(e.isRemoteReview)return(0,H.jsx)(it,{session:e});if(e.status===`completed`)return(0,H.jsx)(A,{bold:!0,color:`success`,dimColor:!0,children:`done`});if(e.status===`failed`)return(0,H.jsx)(A,{bold:!0,color:`error`,dimColor:!0,children:`error`});if(!e.todoList.length)return(0,H.jsxs)(A,{dimColor:!0,children:[e.status,`…`]});let t=ke(e.todoList,e=>e.status===`completed`),n=e.todoList.length;return(0,H.jsxs)(A,{dimColor:!0,children:[t,`/`,n]})}var ot,H,st,ct=e((()=>{ot=t(M(),1),Me(),pe(),N(),Ae(),he(),H=F(),st=80}));function U({status:e,label:t,suffix:n}){return(0,W.jsxs)(A,{color:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:void 0,dimColor:!0,children:[`(`,t??e,n,`)`]})}function lt({shell:e}){switch(e.status){case`completed`:return(0,W.jsx)(U,{status:`completed`,label:`done`});case`failed`:return(0,W.jsx)(U,{status:`failed`,label:`error`});case`killed`:return(0,W.jsx)(U,{status:`killed`,label:`stopped`});case`running`:case`pending`:return(0,W.jsx)(U,{status:`running`})}}var W,ut=e((()=>{N(),W=F()}));function dt({task:e,maxActivityWidth:t}){let n=t??40;switch(e.type){case`local_bash`:return(0,G.jsxs)(A,{children:[I(e.command,n,!0),` `,(0,G.jsx)(lt,{shell:e})]});case`remote_agent`:return e.isRemoteReview?(0,G.jsx)(A,{children:(0,G.jsx)(at,{session:e})}):(0,G.jsxs)(A,{children:[(0,G.jsxs)(A,{dimColor:!0,children:[e.status===`running`||e.status===`pending`?`◇`:`◆`,` `]}),I(e.title,n,!0),(0,G.jsx)(A,{dimColor:!0,children:` · `}),(0,G.jsx)(at,{session:e})]});case`local_agent`:return(0,G.jsxs)(A,{children:[I(e.description,n,!0),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]});case`local_workflow`:{let t=e;return(0,G.jsxs)(A,{children:[I(t.workflowName??e.summary??e.description,n,!0),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`running`?`${t.agentCount} ${R(t.agentCount,`agent`)}`:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}case`dream`:{let t=e.filesTouched.length,n=e.phase===`updating`&&t>0?`${t} ${R(t,`file`)}`:`${e.sessionsReviewing} ${R(e.sessionsReviewing,`session`)}`;return(0,G.jsxs)(A,{children:[e.description,` `,(0,G.jsxs)(A,{dimColor:!0,children:[`· `,e.phase,` · `,n]}),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}}}var G,ft=e((()=>{N(),L(),Le(),Me(),ct(),ut(),G=F()}));function pt({task:e,onDone:t,onBack:n,onKill:r}){let i=z(e.startTime,e.status===`running`,1e3,0);O({"confirm:yes":t},{context:`Confirmation`});let a=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&n?(i.preventDefault(),n()):i.key===`x`&&e.status===`running`&&r&&(i.preventDefault(),r())},o=e.turns.filter(e=>e.text!==``),s=o.slice(-6),c=o.length-s.length;return(0,K.jsx)(k,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:a,children:(0,K.jsx)(P,{title:`Memory consolidation`,subtitle:(0,K.jsxs)(A,{dimColor:!0,children:[i,` · reviewing `,e.sessionsReviewing,` `,R(e.sessionsReviewing,`session`),e.filesTouched.length>0&&(0,K.jsxs)(K.Fragment,{children:[` `,`· `,e.filesTouched.length,` `,R(e.filesTouched.length,`file`),` touched`]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,K.jsxs)(A,{children:[`Press `,t.keyName,` again to exit`]}):(0,K.jsxs)(j,{children:[n&&(0,K.jsx)(D,{shortcut:`←`,action:`go back`}),(0,K.jsx)(D,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&r&&(0,K.jsx)(D,{shortcut:`x`,action:`stop`})]}),children:(0,K.jsxs)(k,{flexDirection:`column`,gap:1,children:[(0,K.jsxs)(A,{children:[(0,K.jsx)(A,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,K.jsx)(A,{color:`background`,children:`running`}):e.status===`completed`?(0,K.jsx)(A,{color:`success`,children:e.status}):(0,K.jsx)(A,{color:`error`,children:e.status})]}),s.length===0?(0,K.jsx)(A,{dimColor:!0,children:e.status===`running`?`Starting…`:`(no text output)`}):(0,K.jsxs)(K.Fragment,{children:[c>0&&(0,K.jsxs)(A,{dimColor:!0,children:[`(`,c,` earlier `,R(c,`turn`),`)`]}),s.map((e,t)=>(0,K.jsxs)(k,{flexDirection:`column`,children:[(0,K.jsx)(A,{wrap:`wrap`,children:e.text}),e.toolUseCount>0&&(0,K.jsxs)(A,{dimColor:!0,children:[` `,`(`,e.toolUseCount,` `,R(e.toolUseCount,`tool`),`)`]})]},t))]})]})})})}var K,mt=e((()=>{B(),N(),ve(),Le(),K=F()}));function ht({stage:e,completed:t,hasProgress:n}){let r=e?yt.indexOf(e):-1,i=!t&&!n;return(0,J.jsxs)(A,{children:[i?(0,J.jsx)(A,{color:`background`,children:`Setup`}):(0,J.jsx)(A,{dimColor:!0,children:`Setup`}),(0,J.jsx)(A,{dimColor:!0,children:` → `}),yt.map((e,n)=>{let a=!t&&!i&&n===r;return(0,J.jsxs)(q.Fragment,{children:[n>0&&(0,J.jsx)(A,{dimColor:!0,children:` → `}),a?(0,J.jsx)(A,{color:`background`,children:bt[e]}):(0,J.jsx)(A,{dimColor:!0,children:bt[e]})]},e)}),t&&(0,J.jsx)(A,{color:`success`,children:` ✓`})]})}function gt(e){let t=e.reviewProgress;if(!t)return e.status===`completed`?`done`:`setting up`;let n=t.bugsVerified,r=t.bugsRefuted??0;if(e.status===`completed`){let e=[`${n} ${R(n,`finding`)}`];return r>0&&e.push(`${r} refuted`),e.join(` · `)}return tt(t.stage,t.bugsFound,n,r)}function _t({session:e,onDone:t,onBack:n,onKill:r}){let i=e.status===`completed`,a=e.status===`running`||e.status===`pending`,[o,s]=(0,q.useState)(!1),c=z(e.startTime,a,1e3,0,e.endTime),l=()=>t(`Remote session details dismissed`,{display:`system`}),u=n??l,d=w(e.sessionId),f=i?`ready`:a?`running`:e.status;if(o)return(0,J.jsx)(P,{title:`Stop ultrareview?`,onCancel:()=>s(!1),color:`background`,children:(0,J.jsxs)(k,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(A,{dimColor:!0,children:`This archives the remote session and stops local tracking. The review will not complete and any findings so far are discarded.`}),(0,J.jsx)(b,{options:[{label:`Stop ultrareview`,value:`stop`},{label:`Back`,value:`back`}],onChange:e=>{e===`stop`?(r?.(),u()):s(!1)}})]})});let p=i?[{label:`Open in Claude Code on the web`,value:`open`},{label:`Dismiss`,value:`dismiss`}]:[{label:`Open in Claude Code on the web`,value:`open`},...r&&a?[{label:`Stop ultrareview`,value:`stop`}]:[],{label:`Back`,value:`back`}];return(0,J.jsx)(P,{title:(0,J.jsxs)(A,{children:[(0,J.jsxs)(A,{color:`background`,children:[i?`◆`:`◇`,` `]}),(0,J.jsx)(A,{bold:!0,children:`ultrareview`}),(0,J.jsxs)(A,{dimColor:!0,children:[` · `,c,` · `,f]})]}),onCancel:u,color:`background`,inputGuide:e=>e.pending?(0,J.jsxs)(A,{children:[`Press `,e.keyName,` again to exit`]}):(0,J.jsxs)(j,{children:[(0,J.jsx)(D,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(D,{shortcut:`Esc`,action:`go back`})]}),children:(0,J.jsxs)(k,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(ht,{stage:e.reviewProgress?.stage,completed:i,hasProgress:!!e.reviewProgress}),(0,J.jsxs)(k,{flexDirection:`column`,children:[(0,J.jsx)(A,{children:gt(e)}),(0,J.jsx)(Se,{url:d,children:(0,J.jsx)(A,{dimColor:!0,children:d})})]}),(0,J.jsx)(b,{options:p,onChange:e=>{switch(e){case`open`:ge(d),t();break;case`stop`:s(!0);break;case`back`:u();break;case`dismiss`:l();break}}})]})})}function vt({session:e,toolUseContext:t,onDone:n,onBack:r,onKill:i}){let[a,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(null),d=(0,q.useMemo)(()=>e.isRemoteReview?[]:u(He(e.log)).filter(e=>e.type!==`progress`).slice(-3),[e]);if(e.isRemoteReview)return(0,J.jsx)(_t,{session:e,onDone:n,onBack:r,onKill:i});let f=()=>n(`Remote session details dismissed`,{display:`system`}),p=e=>{e.key===` `?(e.preventDefault(),n(`Remote session details dismissed`,{display:`system`})):e.key===`left`&&r?(e.preventDefault(),r()):e.key===`t`&&!a?(e.preventDefault(),m()):e.key===`return`&&(e.preventDefault(),f())};async function m(){s(!0),l(null);try{await de(e.sessionId)}catch(e){l(Te(e))}finally{s(!1)}}let h=Ne(e.title,50),g=e.status===`pending`?`starting`:e.status;return(0,J.jsx)(k,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:p,children:(0,J.jsxs)(P,{title:`Remote session details`,onCancel:f,color:`background`,inputGuide:e=>e.pending?(0,J.jsxs)(A,{children:[`Press `,e.keyName,` again to exit`]}):(0,J.jsxs)(j,{children:[r&&(0,J.jsx)(D,{shortcut:`←`,action:`go back`}),(0,J.jsx)(D,{shortcut:`Esc/Enter/Space`,action:`close`}),!a&&(0,J.jsx)(D,{shortcut:`t`,action:`teleport`})]}),children:[(0,J.jsxs)(k,{flexDirection:`column`,children:[(0,J.jsxs)(A,{children:[(0,J.jsx)(A,{bold:!0,children:`Status`}),`:`,` `,g===`running`||g===`starting`?(0,J.jsx)(A,{color:`background`,children:g}):g===`completed`?(0,J.jsx)(A,{color:`success`,children:g}):(0,J.jsx)(A,{color:`error`,children:g})]}),(0,J.jsxs)(A,{children:[(0,J.jsx)(A,{bold:!0,children:`Runtime`}),`: `,Fe((e.endTime??Date.now())-e.startTime)]}),(0,J.jsxs)(A,{wrap:`truncate-end`,children:[(0,J.jsx)(A,{bold:!0,children:`Title`}),`: `,h]}),(0,J.jsxs)(A,{children:[(0,J.jsx)(A,{bold:!0,children:`Progress`}),`: `,(0,J.jsx)(at,{session:e})]}),(0,J.jsxs)(A,{children:[(0,J.jsx)(A,{bold:!0,children:`Session URL`}),`:`,` `,(0,J.jsx)(Se,{url:w(e.sessionId),children:(0,J.jsx)(A,{dimColor:!0,children:w(e.sessionId)})})]})]}),e.log.length>0&&(0,J.jsxs)(k,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(A,{children:[(0,J.jsx)(A,{bold:!0,children:`Recent messages`}),`:`]}),(0,J.jsx)(k,{flexDirection:`column`,height:10,overflowY:`hidden`,children:d.map((e,n)=>(0,J.jsx)(o,{message:e,lookups:oe,addMargin:n>0,tools:t.options.tools,commands:t.options.commands,verbose:t.options.verbose,inProgressToolUseIDs:new Set,progressMessagesForMessage:[],shouldAnimate:!1,shouldShowDot:!1,style:`condensed`,isTranscriptMode:!1,isStatic:!0},n))}),(0,J.jsx)(k,{marginTop:1,children:(0,J.jsxs)(A,{dimColor:!0,italic:!0,children:[`Showing last `,d.length,` of `,e.log.length,` messages`]})})]}),c&&(0,J.jsx)(k,{marginTop:1,children:(0,J.jsxs)(A,{color:`error`,children:[`Teleport failed: `,c]})}),a&&(0,J.jsx)(A,{color:`background`,children:`Teleporting to session…`})]})})}var q,J,yt,bt,xt=e((()=>{q=t(M(),1),Me(),B(),N(),x(),Re(),ae(),Ee(),L(),Ue(),h(),Le(),T(),a(),v(),ct(),J=F(),yt=[`finding`,`verifying`,`synthesizing`],bt={finding:`Find`,verifying:`Verify`,synthesizing:`Dedupe`}}));async function St(e){let t=l(e.id);try{let e=await De(t,Tt);return{content:e.content,bytesTotal:e.bytesTotal}}catch{return{content:``,bytesTotal:0}}}function Ct({shell:e,onDone:t,onKillShell:n,onBack:r}){let{columns:i}=we(),[a,o]=(0,Y.useState)(()=>St(e)),s=(0,Y.useDeferredValue)(a);(0,Y.useEffect)(()=>{if(e.status!==`running`)return;let t=setInterval((e,t)=>e(St(t)),1e3,o,e);return()=>clearInterval(t)},[e.id,e.status]);let c=()=>t(`Shell details dismissed`,{display:`system`});O({"confirm:yes":c},{context:`Confirmation`});let l=i=>{i.key===` `?(i.preventDefault(),t(`Shell details dismissed`,{display:`system`})):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},u=Ne(e.command,280);return(0,X.jsx)(k,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:l,children:(0,X.jsxs)(P,{title:`Shell details`,onCancel:c,color:`background`,inputGuide:t=>t.pending?(0,X.jsxs)(A,{children:[`Press `,t.keyName,` again to exit`]}):(0,X.jsxs)(j,{children:[r&&(0,X.jsx)(D,{shortcut:`←`,action:`go back`}),(0,X.jsx)(D,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,X.jsx)(D,{shortcut:`x`,action:`stop`})]}),children:[(0,X.jsxs)(k,{flexDirection:`column`,children:[(0,X.jsxs)(A,{children:[(0,X.jsx)(A,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,X.jsxs)(A,{color:`background`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):e.status===`completed`?(0,X.jsxs)(A,{color:`success`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):(0,X.jsxs)(A,{color:`error`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]})]}),(0,X.jsxs)(A,{children:[(0,X.jsx)(A,{bold:!0,children:`Runtime:`}),` `,Fe((e.endTime??Date.now())-e.startTime)]}),(0,X.jsxs)(A,{wrap:`wrap`,children:[(0,X.jsx)(A,{bold:!0,children:`Command:`}),` `,u]})]}),(0,X.jsxs)(k,{flexDirection:`column`,children:[(0,X.jsx)(A,{bold:!0,children:`Output:`}),(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(A,{dimColor:!0,children:`Loading output…`}),children:(0,X.jsx)(wt,{outputPromise:s,columns:i})})]})]})})}function wt({outputPromise:e,columns:t}){let{content:n,bytesTotal:r}=(0,Y.use)(e);if(!n)return(0,X.jsx)(A,{dimColor:!0,children:`No output available`});let i=[],a=n.length;for(let e=0;e<10&&a>0;e++){let e=n.lastIndexOf(`
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$h as i,$u as a,Af as o,Ag as s,Dg as c,En as l,Ga as u,If as d,Is as f,Jh as p,Kc as m,La as h,Lf as g,Ls as _,Mf as v,On as y,Qu as b,Xh as ee,Zh as te,ad as ne,au as x,dC as S,df as re,dp as ie,eS as ae,ea as oe,fC as se,fp as ce,gC as C,iu as w,lu as T,nd as E,nu as le,op as ue,pu as de,qc as fe,qh as pe,ru as me,sp as he,tS as ge,tu as _e,uC as ve,uf as ye,wa as be}from"./loadAgentsDir-DaNpxaO-.js";import{D,Gt as O,H as xe,I as k,Lt as Se,P as A,T as j,ai as M,mt as Ce,ot as we,t as N,y as P}from"./src-DL3w8VPk2.js";import{t as F}from"./jsx-runtime-Bb4Xn-E0.js";import{P as Te,R as Ee,_ as De,f as Oe}from"./debug-D58GQBDG.js";import{In as ke,Ln as Ae,Rn as je,Ut as Me}from"./settings-3xZ0fsvE.js";import{C as Ne,b as I,f as Pe,l as Fe,u as Ie,v as L}from"./startupProfiler-CbzxVmbv.js";import{l as R,o as Le}from"./stringUtils-CKD8qDqx.js";import{Nt as Re,_n as ze,gn as Be,vn as Ve}from"./prompt-8u06WVES.js";import{i as He,n as Ue}from"./mappers-_B-s9fNz.js";function z(e,t,n=1e3,r=0,i){let a=()=>Fe(Math.max(0,(i??Date.now())-e-r));return(0,We.useSyncExternalStore)((0,We.useCallback)(e=>{if(!t)return()=>{};let r=setInterval(e,n);return()=>clearInterval(r)},[t,n]),a,a)}var We,B=e((()=>{We=t(M(),1),L()}));function Ge(e,t,n){let r=Be(t,e.toolName);if(!r)return e.toolName;try{let t=r.inputSchema.safeParse(e.input),i=t.success?t.data:{},a=r.userFacingName(i);if(!a)return e.toolName;let o=r.renderToolUseMessage(i,{theme:n,verbose:!1});return o?(0,Ke.jsxs)(A,{children:[a,`(`,o,`)`]}):a}catch{return e.toolName}}var Ke,qe=e((()=>{N(),Ve(),Ke=F()}));function Je(e,t){let{isIdle:n,awaitingApproval:i,hasError:a,shutdownRequested:o}=t??{};return a?r.cross:i?r.questionMarkPrefix:o?r.warning:e===`running`?n?r.ellipsis:r.play:e===`completed`?r.tick:e===`failed`||e===`killed`?r.cross:r.bullet}function Ye(e,t){let{isIdle:n,awaitingApproval:r,hasError:i,shutdownRequested:a}=t??{};return i?`error`:r||a?`warning`:n?`background`:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:`background`}function Xe(e,t){if(!t)return!1;let n=!1;for(let t of Object.values(e))if(g(t))return n=!0,!1;return n}var Ze=e((()=>{n(),d()}));function Qe({agent:e,onDone:t,onKillAgent:n,onBack:r}){let[i]=xe(),a=(0,$e.useMemo)(()=>m(ze()),[]),o=z(e.startTime,e.status===`running`,1e3,e.totalPausedMs??0);O({"confirm:yes":t},{context:`Confirmation`});let s=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},c=be(e.prompt,`plan`),l=e.prompt.length>300?`${e.prompt.substring(0,297)}…`:e.prompt,u=e.result?.totalTokens??e.progress?.tokenCount,d=e.result?.totalToolUseCount??e.progress?.toolUseCount;return(0,V.jsx)(k,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:s,children:(0,V.jsx)(P,{title:(0,V.jsxs)(A,{children:[e.selectedAgent?.agentType??`agent`,` › `,e.description||`Async agent`]}),subtitle:(0,V.jsxs)(A,{children:[e.status!==`running`&&(0,V.jsxs)(A,{color:Ye(e.status),children:[Je(e.status),` `,e.status===`completed`?`Completed`:e.status===`failed`?`Failed`:`Stopped`,` · `]}),(0,V.jsxs)(A,{dimColor:!0,children:[o,u!==void 0&&u>0&&(0,V.jsxs)(V.Fragment,{children:[` · `,Pe(u),` tokens`]}),d!==void 0&&d>0&&(0,V.jsxs)(V.Fragment,{children:[` `,`· `,d,` `,d===1?`tool`:`tools`]})]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,V.jsxs)(A,{children:[`Press `,t.keyName,` again to exit`]}):(0,V.jsxs)(j,{children:[r&&(0,V.jsx)(D,{shortcut:`←`,action:`go back`}),(0,V.jsx)(D,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,V.jsx)(D,{shortcut:`x`,action:`stop`})]}),children:(0,V.jsxs)(k,{flexDirection:`column`,children:[e.status===`running`&&e.progress?.recentActivities&&e.progress.recentActivities.length>0&&(0,V.jsxs)(k,{flexDirection:`column`,children:[(0,V.jsx)(A,{bold:!0,dimColor:!0,children:`Progress`}),e.progress.recentActivities.map((t,n)=>(0,V.jsxs)(A,{dimColor:n<e.progress.recentActivities.length-1,wrap:`truncate-end`,children:[n===e.progress.recentActivities.length-1?`› `:` `,Ge(t,a,i)]},n))]}),c?(0,V.jsx)(k,{marginTop:1,children:(0,V.jsx)(ie,{addMargin:!1,planContent:c})}):(0,V.jsxs)(k,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(A,{bold:!0,dimColor:!0,children:`Prompt`}),(0,V.jsx)(A,{wrap:`wrap`,children:l})]}),e.status===`failed`&&e.error&&(0,V.jsxs)(k,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(A,{bold:!0,color:`error`,children:`Error`}),(0,V.jsx)(A,{color:`error`,wrap:`wrap`,children:e.error})]})]})})})}var $e,V,et=e((()=>{$e=t(M(),1),B(),N(),ve(),Ve(),fe(),L(),h(),ce(),qe(),Ze(),V=F()}));function tt(e,t,n,r){if(!e)return`${t} found · ${n} verified`;if(e===`synthesizing`){let e=[`${n} verified`];return r>0&&e.push(`${r} refuted`),e.push(`deduping`),e.join(` · `)}if(e===`verifying`){let e=[`${t} found`,`${n} verified`];return r>0&&e.push(`${r} refuted`),e.join(` · `)}return t>0?`${t} found`:`finding`}function nt({text:e,phase:t=0}){return(0,H.jsx)(H.Fragment,{children:[...e].map((e,n)=>(0,H.jsx)(A,{color:ue(n+t),children:e},n))})}function rt(e,t,n){let r=(0,ot.useRef)(e),i=(0,ot.useRef)(t);return n||e<r.current?r.current=e:e>r.current&&t!==i.current&&(r.current+=1,i.current=t),r.current}function it({session:e}){let t=p().prefersReducedMotion??!1,n=e.reviewProgress,r=e.status===`running`,[,i]=Ce(r&&!t?st:null),a=n?.bugsFound??0,o=n?.bugsVerified??0,s=n?.bugsRefuted??0,c=t||!r,l=rt(a,i,c),u=rt(o,i,c),d=rt(s,i,c),f=Math.floor(i/(st*3))%7;if(e.status===`completed`)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(A,{color:`background`,children:[`◆`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:0}),(0,H.jsx)(A,{dimColor:!0,children:` ready · shift+↓ to view`})]});if(e.status===`failed`)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(A,{color:`background`,children:[`◆`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:0}),(0,H.jsxs)(A,{color:`error`,dimColor:!0,children:[` · `,`error`]})]});let m=n?tt(n.stage,l,u,d):`setting up`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(A,{color:`background`,children:[`◇`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:r?f:0}),(0,H.jsxs)(A,{dimColor:!0,children:[` · `,m]})]})}function at({session:e}){if(e.isRemoteReview)return(0,H.jsx)(it,{session:e});if(e.status===`completed`)return(0,H.jsx)(A,{bold:!0,color:`success`,dimColor:!0,children:`done`});if(e.status===`failed`)return(0,H.jsx)(A,{bold:!0,color:`error`,dimColor:!0,children:`error`});if(!e.todoList.length)return(0,H.jsxs)(A,{dimColor:!0,children:[e.status,`…`]});let t=ke(e.todoList,e=>e.status===`completed`),n=e.todoList.length;return(0,H.jsxs)(A,{dimColor:!0,children:[t,`/`,n]})}var ot,H,st,ct=e((()=>{ot=t(M(),1),Me(),pe(),N(),Ae(),he(),H=F(),st=80}));function U({status:e,label:t,suffix:n}){return(0,W.jsxs)(A,{color:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:void 0,dimColor:!0,children:[`(`,t??e,n,`)`]})}function lt({shell:e}){switch(e.status){case`completed`:return(0,W.jsx)(U,{status:`completed`,label:`done`});case`failed`:return(0,W.jsx)(U,{status:`failed`,label:`error`});case`killed`:return(0,W.jsx)(U,{status:`killed`,label:`stopped`});case`running`:case`pending`:return(0,W.jsx)(U,{status:`running`})}}var W,ut=e((()=>{N(),W=F()}));function dt({task:e,maxActivityWidth:t}){let n=t??40;switch(e.type){case`local_bash`:return(0,G.jsxs)(A,{children:[I(e.command,n,!0),` `,(0,G.jsx)(lt,{shell:e})]});case`remote_agent`:return e.isRemoteReview?(0,G.jsx)(A,{children:(0,G.jsx)(at,{session:e})}):(0,G.jsxs)(A,{children:[(0,G.jsxs)(A,{dimColor:!0,children:[e.status===`running`||e.status===`pending`?`◇`:`◆`,` `]}),I(e.title,n,!0),(0,G.jsx)(A,{dimColor:!0,children:` · `}),(0,G.jsx)(at,{session:e})]});case`local_agent`:return(0,G.jsxs)(A,{children:[I(e.description,n,!0),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]});case`local_workflow`:{let t=e;return(0,G.jsxs)(A,{children:[I(t.workflowName??e.summary??e.description,n,!0),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`running`?`${t.agentCount} ${R(t.agentCount,`agent`)}`:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}case`dream`:{let t=e.filesTouched.length,n=e.phase===`updating`&&t>0?`${t} ${R(t,`file`)}`:`${e.sessionsReviewing} ${R(e.sessionsReviewing,`session`)}`;return(0,G.jsxs)(A,{children:[e.description,` `,(0,G.jsxs)(A,{dimColor:!0,children:[`· `,e.phase,` · `,n]}),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}}}var G,ft=e((()=>{N(),L(),Le(),Me(),ct(),ut(),G=F()}));function pt({task:e,onDone:t,onBack:n,onKill:r}){let i=z(e.startTime,e.status===`running`,1e3,0);O({"confirm:yes":t},{context:`Confirmation`});let a=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&n?(i.preventDefault(),n()):i.key===`x`&&e.status===`running`&&r&&(i.preventDefault(),r())},o=e.turns.filter(e=>e.text!==``),s=o.slice(-6),c=o.length-s.length;return(0,K.jsx)(k,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:a,children:(0,K.jsx)(P,{title:`Memory consolidation`,subtitle:(0,K.jsxs)(A,{dimColor:!0,children:[i,` · reviewing `,e.sessionsReviewing,` `,R(e.sessionsReviewing,`session`),e.filesTouched.length>0&&(0,K.jsxs)(K.Fragment,{children:[` `,`· `,e.filesTouched.length,` `,R(e.filesTouched.length,`file`),` touched`]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,K.jsxs)(A,{children:[`Press `,t.keyName,` again to exit`]}):(0,K.jsxs)(j,{children:[n&&(0,K.jsx)(D,{shortcut:`←`,action:`go back`}),(0,K.jsx)(D,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&r&&(0,K.jsx)(D,{shortcut:`x`,action:`stop`})]}),children:(0,K.jsxs)(k,{flexDirection:`column`,gap:1,children:[(0,K.jsxs)(A,{children:[(0,K.jsx)(A,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,K.jsx)(A,{color:`background`,children:`running`}):e.status===`completed`?(0,K.jsx)(A,{color:`success`,children:e.status}):(0,K.jsx)(A,{color:`error`,children:e.status})]}),s.length===0?(0,K.jsx)(A,{dimColor:!0,children:e.status===`running`?`Starting…`:`(no text output)`}):(0,K.jsxs)(K.Fragment,{children:[c>0&&(0,K.jsxs)(A,{dimColor:!0,children:[`(`,c,` earlier `,R(c,`turn`),`)`]}),s.map((e,t)=>(0,K.jsxs)(k,{flexDirection:`column`,children:[(0,K.jsx)(A,{wrap:`wrap`,children:e.text}),e.toolUseCount>0&&(0,K.jsxs)(A,{dimColor:!0,children:[` `,`(`,e.toolUseCount,` `,R(e.toolUseCount,`tool`),`)`]})]},t))]})]})})})}var K,mt=e((()=>{B(),N(),ve(),Le(),K=F()}));function ht({stage:e,completed:t,hasProgress:n}){let r=e?yt.indexOf(e):-1,i=!t&&!n;return(0,J.jsxs)(A,{children:[i?(0,J.jsx)(A,{color:`background`,children:`Setup`}):(0,J.jsx)(A,{dimColor:!0,children:`Setup`}),(0,J.jsx)(A,{dimColor:!0,children:` → `}),yt.map((e,n)=>{let a=!t&&!i&&n===r;return(0,J.jsxs)(q.Fragment,{children:[n>0&&(0,J.jsx)(A,{dimColor:!0,children:` → `}),a?(0,J.jsx)(A,{color:`background`,children:bt[e]}):(0,J.jsx)(A,{dimColor:!0,children:bt[e]})]},e)}),t&&(0,J.jsx)(A,{color:`success`,children:` ✓`})]})}function gt(e){let t=e.reviewProgress;if(!t)return e.status===`completed`?`done`:`setting up`;let n=t.bugsVerified,r=t.bugsRefuted??0;if(e.status===`completed`){let e=[`${n} ${R(n,`finding`)}`];return r>0&&e.push(`${r} refuted`),e.join(` · `)}return tt(t.stage,t.bugsFound,n,r)}function _t({session:e,onDone:t,onBack:n,onKill:r}){let i=e.status===`completed`,a=e.status===`running`||e.status===`pending`,[o,s]=(0,q.useState)(!1),c=z(e.startTime,a,1e3,0,e.endTime),l=()=>t(`Remote session details dismissed`,{display:`system`}),u=n??l,d=w(e.sessionId),f=i?`ready`:a?`running`:e.status;if(o)return(0,J.jsx)(P,{title:`Stop ultrareview?`,onCancel:()=>s(!1),color:`background`,children:(0,J.jsxs)(k,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(A,{dimColor:!0,children:`This archives the remote session and stops local tracking. The review will not complete and any findings so far are discarded.`}),(0,J.jsx)(b,{options:[{label:`Stop ultrareview`,value:`stop`},{label:`Back`,value:`back`}],onChange:e=>{e===`stop`?(r?.(),u()):s(!1)}})]})});let p=i?[{label:`Open in Work Mate on the web`,value:`open`},{label:`Dismiss`,value:`dismiss`}]:[{label:`Open in Work Mate on the web`,value:`open`},...r&&a?[{label:`Stop ultrareview`,value:`stop`}]:[],{label:`Back`,value:`back`}];return(0,J.jsx)(P,{title:(0,J.jsxs)(A,{children:[(0,J.jsxs)(A,{color:`background`,children:[i?`◆`:`◇`,` `]}),(0,J.jsx)(A,{bold:!0,children:`ultrareview`}),(0,J.jsxs)(A,{dimColor:!0,children:[` · `,c,` · `,f]})]}),onCancel:u,color:`background`,inputGuide:e=>e.pending?(0,J.jsxs)(A,{children:[`Press `,e.keyName,` again to exit`]}):(0,J.jsxs)(j,{children:[(0,J.jsx)(D,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(D,{shortcut:`Esc`,action:`go back`})]}),children:(0,J.jsxs)(k,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(ht,{stage:e.reviewProgress?.stage,completed:i,hasProgress:!!e.reviewProgress}),(0,J.jsxs)(k,{flexDirection:`column`,children:[(0,J.jsx)(A,{children:gt(e)}),(0,J.jsx)(Se,{url:d,children:(0,J.jsx)(A,{dimColor:!0,children:d})})]}),(0,J.jsx)(b,{options:p,onChange:e=>{switch(e){case`open`:ge(d),t();break;case`stop`:s(!0);break;case`back`:u();break;case`dismiss`:l();break}}})]})})}function vt({session:e,toolUseContext:t,onDone:n,onBack:r,onKill:i}){let[a,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(null),d=(0,q.useMemo)(()=>e.isRemoteReview?[]:u(He(e.log)).filter(e=>e.type!==`progress`).slice(-3),[e]);if(e.isRemoteReview)return(0,J.jsx)(_t,{session:e,onDone:n,onBack:r,onKill:i});let f=()=>n(`Remote session details dismissed`,{display:`system`}),p=e=>{e.key===` `?(e.preventDefault(),n(`Remote session details dismissed`,{display:`system`})):e.key===`left`&&r?(e.preventDefault(),r()):e.key===`t`&&!a?(e.preventDefault(),m()):e.key===`return`&&(e.preventDefault(),f())};async function m(){s(!0),l(null);try{await de(e.sessionId)}catch(e){l(Te(e))}finally{s(!1)}}let h=Ne(e.title,50),g=e.status===`pending`?`starting`:e.status;return(0,J.jsx)(k,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:p,children:(0,J.jsxs)(P,{title:`Remote session details`,onCancel:f,color:`background`,inputGuide:e=>e.pending?(0,J.jsxs)(A,{children:[`Press `,e.keyName,` again to exit`]}):(0,J.jsxs)(j,{children:[r&&(0,J.jsx)(D,{shortcut:`←`,action:`go back`}),(0,J.jsx)(D,{shortcut:`Esc/Enter/Space`,action:`close`}),!a&&(0,J.jsx)(D,{shortcut:`t`,action:`teleport`})]}),children:[(0,J.jsxs)(k,{flexDirection:`column`,children:[(0,J.jsxs)(A,{children:[(0,J.jsx)(A,{bold:!0,children:`Status`}),`:`,` `,g===`running`||g===`starting`?(0,J.jsx)(A,{color:`background`,children:g}):g===`completed`?(0,J.jsx)(A,{color:`success`,children:g}):(0,J.jsx)(A,{color:`error`,children:g})]}),(0,J.jsxs)(A,{children:[(0,J.jsx)(A,{bold:!0,children:`Runtime`}),`: `,Fe((e.endTime??Date.now())-e.startTime)]}),(0,J.jsxs)(A,{wrap:`truncate-end`,children:[(0,J.jsx)(A,{bold:!0,children:`Title`}),`: `,h]}),(0,J.jsxs)(A,{children:[(0,J.jsx)(A,{bold:!0,children:`Progress`}),`: `,(0,J.jsx)(at,{session:e})]}),(0,J.jsxs)(A,{children:[(0,J.jsx)(A,{bold:!0,children:`Session URL`}),`:`,` `,(0,J.jsx)(Se,{url:w(e.sessionId),children:(0,J.jsx)(A,{dimColor:!0,children:w(e.sessionId)})})]})]}),e.log.length>0&&(0,J.jsxs)(k,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(A,{children:[(0,J.jsx)(A,{bold:!0,children:`Recent messages`}),`:`]}),(0,J.jsx)(k,{flexDirection:`column`,height:10,overflowY:`hidden`,children:d.map((e,n)=>(0,J.jsx)(o,{message:e,lookups:oe,addMargin:n>0,tools:t.options.tools,commands:t.options.commands,verbose:t.options.verbose,inProgressToolUseIDs:new Set,progressMessagesForMessage:[],shouldAnimate:!1,shouldShowDot:!1,style:`condensed`,isTranscriptMode:!1,isStatic:!0},n))}),(0,J.jsx)(k,{marginTop:1,children:(0,J.jsxs)(A,{dimColor:!0,italic:!0,children:[`Showing last `,d.length,` of `,e.log.length,` messages`]})})]}),c&&(0,J.jsx)(k,{marginTop:1,children:(0,J.jsxs)(A,{color:`error`,children:[`Teleport failed: `,c]})}),a&&(0,J.jsx)(A,{color:`background`,children:`Teleporting to session…`})]})})}var q,J,yt,bt,xt=e((()=>{q=t(M(),1),Me(),B(),N(),x(),Re(),ae(),Ee(),L(),Ue(),h(),Le(),T(),a(),v(),ct(),J=F(),yt=[`finding`,`verifying`,`synthesizing`],bt={finding:`Find`,verifying:`Verify`,synthesizing:`Dedupe`}}));async function St(e){let t=l(e.id);try{let e=await De(t,Tt);return{content:e.content,bytesTotal:e.bytesTotal}}catch{return{content:``,bytesTotal:0}}}function Ct({shell:e,onDone:t,onKillShell:n,onBack:r}){let{columns:i}=we(),[a,o]=(0,Y.useState)(()=>St(e)),s=(0,Y.useDeferredValue)(a);(0,Y.useEffect)(()=>{if(e.status!==`running`)return;let t=setInterval((e,t)=>e(St(t)),1e3,o,e);return()=>clearInterval(t)},[e.id,e.status]);let c=()=>t(`Shell details dismissed`,{display:`system`});O({"confirm:yes":c},{context:`Confirmation`});let l=i=>{i.key===` `?(i.preventDefault(),t(`Shell details dismissed`,{display:`system`})):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},u=Ne(e.command,280);return(0,X.jsx)(k,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:l,children:(0,X.jsxs)(P,{title:`Shell details`,onCancel:c,color:`background`,inputGuide:t=>t.pending?(0,X.jsxs)(A,{children:[`Press `,t.keyName,` again to exit`]}):(0,X.jsxs)(j,{children:[r&&(0,X.jsx)(D,{shortcut:`←`,action:`go back`}),(0,X.jsx)(D,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,X.jsx)(D,{shortcut:`x`,action:`stop`})]}),children:[(0,X.jsxs)(k,{flexDirection:`column`,children:[(0,X.jsxs)(A,{children:[(0,X.jsx)(A,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,X.jsxs)(A,{color:`background`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):e.status===`completed`?(0,X.jsxs)(A,{color:`success`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):(0,X.jsxs)(A,{color:`error`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]})]}),(0,X.jsxs)(A,{children:[(0,X.jsx)(A,{bold:!0,children:`Runtime:`}),` `,Fe((e.endTime??Date.now())-e.startTime)]}),(0,X.jsxs)(A,{wrap:`wrap`,children:[(0,X.jsx)(A,{bold:!0,children:`Command:`}),` `,u]})]}),(0,X.jsxs)(k,{flexDirection:`column`,children:[(0,X.jsx)(A,{bold:!0,children:`Output:`}),(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(A,{dimColor:!0,children:`Loading output…`}),children:(0,X.jsx)(wt,{outputPromise:s,columns:i})})]})]})})}function wt({outputPromise:e,columns:t}){let{content:n,bytesTotal:r}=(0,Y.use)(e);if(!n)return(0,X.jsx)(A,{dimColor:!0,children:`No output available`});let i=[],a=n.length;for(let e=0;e<10&&a>0;e++){let e=n.lastIndexOf(`
|
|
2
2
|
`,a-1);i.push(e+1),a=e}i.reverse();let o=r>n.length,s=[];for(let e=0;e<i.length;e++){let t=i[e],r=e<i.length-1?i[e+1]-1:n.length,a=n.slice(t,r);a&&s.push(a)}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{borderStyle:`round`,paddingX:1,flexDirection:`column`,height:12,maxWidth:t-6,children:s.map((e,t)=>(0,X.jsx)(A,{wrap:`truncate-end`,children:e},t))}),(0,X.jsxs)(A,{dimColor:!0,italic:!0,children:[`Showing ${s.length} lines`,o?` of ${Ie(r)}`:``]})]})}var Y,X,Tt,Et=e((()=>{Y=t(M(),1),C(),N(),ve(),L(),Oe(),y(),X=F(),Tt=8192}));function Dt(e,t){return Object.values(e??{}).filter(g).filter(e=>!(e.type===`local_agent`&&e.id===t))}function Ot({onDone:e,toolUseContext:t,initialDetailTaskId:n}){let r=te(e=>e.tasks),a=te(e=>e.foregroundedTaskId),o=i(),s=se(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),l=r,u=(0,Q.useRef)(!1),[d,p]=(0,Q.useState)(()=>{if(n)return u.current=!0,{mode:`detail`,itemId:n};let e=Dt(l,a);return e.length===1?(u.current=!0,{mode:`detail`,itemId:e[0].id}):{mode:`list`}}),[m,h]=(0,Q.useState)(0);ne(`background-tasks-dialog`);let{bashTasks:_,remoteSessions:v,agentTasks:y,workflowTasks:b,dreamTasks:ee,allSelectableItems:x}=(0,Q.useMemo)(()=>{let e=Object.values(l??{}).filter(g).map(kt).sort((e,t)=>{let n=e.status,r=t.status;if(n===`running`&&r!==`running`)return-1;if(n!==`running`&&r===`running`)return 1;let i=`task`in e?e.task.startTime:0;return(`task`in t?t.task.startTime:0)-i}),t=e.filter(e=>e.type===`local_bash`),n=e.filter(e=>e.type===`remote_agent`),r=e.filter(e=>e.type===`local_agent`&&e.id!==a),i=e.filter(e=>e.type===`local_workflow`),o=e.filter(e=>e.type===`dream`);return{bashTasks:t,remoteSessions:n,agentTasks:r,workflowTasks:i,dreamTasks:o,allSelectableItems:[...t,...n,...r,...i,...o]}},[l,a]),S=x[m]??null;O({"confirm:previous":()=>h(e=>Math.max(0,e-1)),"confirm:next":()=>h(e=>Math.min(x.length-1,e+1)),"confirm:yes":()=>{let e=x[m];e&&p({mode:`detail`,itemId:e.id})}},{context:`Confirmation`,isActive:d.mode===`list`});let re=t=>{if(d.mode!==`list`)return;if(t.key===`left`){t.preventDefault(),e(`Background tasks dialog dismissed`,{display:`system`});return}let n=x[m];n&&t.key===`x`&&(t.preventDefault(),n.type===`local_bash`&&n.status===`running`?ie(n.id):n.type===`local_agent`&&n.status===`running`?ae(n.id):n.type===`local_workflow`&&n.status===`running`?At(n.id,o):n.type===`dream`&&n.status===`running`?oe(n.id):n.type===`remote_agent`&&n.status===`running`&&ce(n.id))};async function ie(e){await c.kill(e,o)}async function ae(e){await f.kill(e,o)}async function oe(e){await ye.kill(e,o)}async function ce(e){await me.kill(e,o)}let C=(0,Q.useEffectEvent)(e);(0,Q.useEffect)(()=>{if(d.mode!==`list`){let e=l?.[d.itemId];(!e||e.type!==`local_workflow`&&!g(e))&&(u.current?C(`Background tasks dialog dismissed`,{display:`system`}):p({mode:`list`}))}let e=x.length;m>=e&&e>0&&h(e-1)},[d,l,m,x,C]);let w=()=>{u.current&&x.length<=1?e(`Background tasks dialog dismissed`,{display:`system`}):(u.current=!1,p({mode:`list`}))};if(d.mode!==`list`&&l){let n=l[d.itemId];if(!n)return null;switch(n.type){case`local_bash`:return(0,$.jsx)(Ct,{shell:n,onDone:e,onKillShell:()=>void ie(n.id),onBack:w},`shell-${n.id}`);case`local_agent`:return(0,$.jsx)(Qe,{agent:n,onDone:e,onKillAgent:()=>void ae(n.id),onBack:w},`agent-${n.id}`);case`remote_agent`:return(0,$.jsx)(vt,{session:n,onDone:e,toolUseContext:t,onBack:w,onKill:n.status===`running`?()=>void ce(n.id):void 0},`session-${n.id}`);case`local_workflow`:{let e=n.status===`running`?()=>At(n.id,o):void 0;return(0,$.jsx)(k,{flexDirection:`column`,tabIndex:0,borderStyle:`round`,onKeyDown:t=>{t.key===`left`?(t.preventDefault(),w()):t.key===`x`&&e&&(t.preventDefault(),e())},children:(0,$.jsx)(P,{title:n.workflowName,subtitle:(0,$.jsxs)(A,{dimColor:!0,children:[n.status,n.summary?` · ${n.summary}`:``]}),onCancel:w,inputGuide:()=>(0,$.jsxs)(j,{children:[(0,$.jsx)(D,{shortcut:`←`,action:`go back`}),(0,$.jsx)(D,{shortcut:`Esc`,action:`close`}),e&&(0,$.jsx)(D,{shortcut:`x`,action:`stop`})]}),children:n.status===`failed`&&n.error?(0,$.jsxs)(A,{color:`error`,children:[`失败原因:`,n.error]}):null})},`workflow-${n.id}`)}case`dream`:return(0,$.jsx)(pt,{task:n,onDone:()=>e(`Background tasks dialog dismissed`,{display:`system`}),onBack:w,onKill:n.status===`running`?()=>void oe(n.id):void 0},`dream-${n.id}`)}}let T=ke(_,e=>e.status===`running`),E=ke(v,e=>e.status===`running`||e.status===`pending`)+ke(y,e=>e.status===`running`),le=je([...T>0?[(0,$.jsxs)(A,{children:[T,` `,T===1?`active shell`:`active shells`]},`shells`)]:[],...E>0?[(0,$.jsxs)(A,{children:[E,` `,E===1?`active agent`:`active agents`]},`agents`)]:[]],e=>(0,$.jsx)(A,{children:` · `},`separator-${e}`)),ue=[(0,$.jsx)(D,{shortcut:`↑/↓`,action:`select`},`upDown`),(0,$.jsx)(D,{shortcut:`Enter`,action:`view`},`enter`),...(S?.type===`local_bash`||S?.type===`local_agent`||S?.type===`local_workflow`||S?.type===`dream`||S?.type===`remote_agent`)&&S.status===`running`?[(0,$.jsx)(D,{shortcut:`x`,action:`stop`},`kill`)]:[],...y.some(e=>e.status===`running`)?[(0,$.jsx)(D,{shortcut:s,action:`stop all agents`},`kill-all`)]:[],(0,$.jsx)(D,{shortcut:`←/Esc`,action:`close`},`esc`)],de=()=>e(`Background tasks dialog dismissed`,{display:`system`});function fe(e){return e.pending?(0,$.jsxs)(A,{children:[`Press `,e.keyName,` again to exit`]}):(0,$.jsx)(j,{children:ue})}return(0,$.jsx)(k,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:re,children:(0,$.jsx)(P,{title:`Background tasks`,subtitle:le,onCancel:de,color:`background`,inputGuide:fe,children:x.length===0?(0,$.jsx)(A,{dimColor:!0,children:`No tasks currently running`}):(0,$.jsxs)(k,{flexDirection:`column`,children:[_.length>0&&(0,$.jsxs)(k,{flexDirection:`column`,children:[(v.length>0||y.length>0)&&(0,$.jsxs)(A,{dimColor:!0,children:[(0,$.jsxs)(A,{bold:!0,children:[` `,`Shells`]}),` (`,_.length,`)`]}),(0,$.jsx)(k,{flexDirection:`column`,children:_.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})]}),v.length>0&&(0,$.jsxs)(k,{flexDirection:`column`,marginTop:+(_.length>0),children:[(0,$.jsxs)(A,{dimColor:!0,children:[(0,$.jsxs)(A,{bold:!0,children:[` `,`Remote agents`]}),` (`,v.length,`)`]}),(0,$.jsx)(k,{flexDirection:`column`,children:v.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})]}),y.length>0&&(0,$.jsxs)(k,{flexDirection:`column`,marginTop:+(_.length>0||v.length>0),children:[(0,$.jsxs)(A,{dimColor:!0,children:[(0,$.jsxs)(A,{bold:!0,children:[` `,`Local agents`]}),` (`,y.length,`)`]}),(0,$.jsx)(k,{flexDirection:`column`,children:y.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})]}),b.length>0&&(0,$.jsxs)(k,{flexDirection:`column`,marginTop:+(_.length>0||v.length>0||y.length>0),children:[(0,$.jsxs)(A,{dimColor:!0,children:[(0,$.jsxs)(A,{bold:!0,children:[` `,`Workflows`]}),` (`,b.length,`)`]}),(0,$.jsx)(k,{flexDirection:`column`,children:b.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})]}),ee.length>0&&(0,$.jsx)(k,{flexDirection:`column`,marginTop:+(_.length>0||v.length>0||y.length>0||b.length>0),children:(0,$.jsx)(k,{flexDirection:`column`,children:ee.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})})]})})})}function kt(e){switch(e.type){case`local_bash`:return{id:e.id,type:`local_bash`,label:e.command,status:e.status,task:e};case`remote_agent`:return{id:e.id,type:`remote_agent`,label:e.title,status:e.status,task:e};case`local_agent`:return{id:e.id,type:`local_agent`,label:e.description,status:e.status,task:e};case`local_workflow`:return{id:e.id,type:`local_workflow`,label:e.summary??e.description,status:e.status,task:e};case`dream`:return{id:e.id,type:`dream`,label:e.description,status:e.status,task:e}}}function Z({item:e,isSelected:t}){let{columns:n}=we(),i=Math.max(30,n-26);return(0,$.jsxs)(k,{flexDirection:`row`,children:[(0,$.jsx)(A,{children:t?`${r.pointer} `:` `}),(0,$.jsx)(A,{color:t?`suggestion`:void 0,children:(0,$.jsx)(dt,{task:e.task,maxActivityWidth:i})})]})}var Q,$,At,jt=e((()=>{n(),Q=t(M(),1),C(),ee(),re(),_(),s(),x(),d(),Ae(),E(),N(),ve(),S(),et(),ft(),mt(),xt(),Et(),_e(),$=F(),At=le}));export{B as a,Xe as i,jt as n,z as o,Ze as r,Ot as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Qd as n,Qu as r,Zu as i}from"./loadAgentsDir-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Qd as n,Qu as r,Zu as i}from"./loadAgentsDir-DaNpxaO-.js";import{I as a,Lt as o,P as s,ai as c,kt as l,t as u,y as d}from"./src-DL3w8VPk2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{b as p,h as m}from"./settings-3xZ0fsvE.js";import{n as h,r as g}from"./analytics-DJobLaWP.js";var _=e(c(),1);h(),u(),t(),m(),i();var v=f();function y({onAccept:e}){let[t,i]=_.useState(null);_.useEffect(()=>{if(t!==null){let e=t,r=setTimeout(()=>n(e));return()=>clearTimeout(r)}},[t]),_.useEffect(()=>{g(`tengu_bypass_permissions_mode_dialog_shown`,{})},[]);function c(t){switch(t){case`accept`:g(`tengu_bypass_permissions_mode_dialog_accept`,{}),p(`userSettings`,{skipDangerousModePermissionPrompt:!0}),e();break;case`decline`:i(1);break}}let u=(0,_.useCallback)(()=>{i(0)},[]);return t===null?(0,v.jsxs)(d,{title:`WARNING: Work Mate running in Bypass Permissions mode`,color:`error`,onCancel:u,children:[(0,v.jsxs)(a,{flexDirection:`column`,gap:1,children:[(0,v.jsxs)(s,{children:[`In Bypass Permissions mode, Work Mate will not ask for your approval before running potentially dangerous commands.`,(0,v.jsx)(l,{}),`This mode should only be used in a sandboxed container/VM that has restricted internet access and can easily be restored if damaged.`]}),(0,v.jsx)(s,{children:`By proceeding, you accept all responsibility for actions taken while running in Bypass Permissions mode.`}),(0,v.jsx)(o,{url:`https://code.workmate.com/docs/en/security`})]}),(0,v.jsx)(r,{options:[{label:`No, exit`,value:`decline`},{label:`Yes, I accept`,value:`accept`}],onChange:e=>c(e)})]}):null}export{y as BypassPermissionsModeDialog};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{Nh as i,Ph as a,ad as o,dC as s,fC as c,gC as l,nd as u,uC as d}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{Nh as i,Ph as a,ad as o,dC as s,fC as c,gC as l,nd as u,uC as d}from"./loadAgentsDir-DaNpxaO-.js";import{C as f,Gt as ee,I as p,P as m,T as h,ai as g,ot as _,t as v,y as te}from"./src-DL3w8VPk2.js";import{t as y}from"./jsx-runtime-Bb4Xn-E0.js";import{n as b,t as x}from"./cwd-Nh5IZNKO.js";import{An as S,Cn as C}from"./settings-3xZ0fsvE.js";import{l as w,m as T,p as E,s as D}from"./git-By_J4XJL.js";import{r as O,t as k}from"./execFileNoThrow-Bmb5HEFz.js";import{S as ne,v as re}from"./startupProfiler-CbzxVmbv.js";import{l as A,o as j}from"./stringUtils-CKD8qDqx.js";import{i as ie}from"./detectRepository-CDOJ-M7h.js";import{join as M,resolve as ae}from"path";import{access as oe}from"fs/promises";async function se(){if(!await w()||await P())return null;let{stdout:e,code:t}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`,`--shortstat`],{timeout:F,preserveOutputOnError:!1});if(t===0){let t=de(e);if(t&&t.filesCount>z)return{stats:t,perFileStats:new Map,hunks:new Map}}let{stdout:n,code:r}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`,`--numstat`],{timeout:F,preserveOutputOnError:!1});if(r!==0)return null;let{stats:i,perFileStats:a}=ce(n),o=I-a.size;if(o>0){let e=await ue(o);if(e){i.filesCount+=e.size;for(let[t,n]of e)a.set(t,n)}}return{stats:i,perFileStats:a,hunks:new Map}}async function N(){if(!await w()||await P())return new Map;let{stdout:e,code:t}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`],{timeout:F,preserveOutputOnError:!1});return t===0?le(e):new Map}function ce(e){let t=e.trim().split(`
|
|
2
2
|
`).filter(Boolean),n=0,r=0,i=0,a=new Map;for(let e of t){let t=e.split(` `);if(t.length<3)continue;i++;let o=t[0],s=t[1],c=t.slice(2).join(` `),l=o===`-`||s===`-`,u=l?0:parseInt(o??`0`,10)||0,d=l?0:parseInt(s??`0`,10)||0;n+=u,r+=d,a.size<I&&a.set(c,{added:u,removed:d,isBinary:l})}return{stats:{filesCount:i,linesAdded:n,linesRemoved:r},perFileStats:a}}function le(e){let t=new Map;if(!e.trim())return t;let n=e.split(/^diff --git /m).filter(Boolean);for(let e of n){if(t.size>=I)break;if(e.length>L)continue;let n=e.split(`
|
|
3
3
|
`),r=n[0]?.match(/^a\/(.+?) b\/(.+)$/);if(!r)continue;let i=r[2]??r[1]??``,a=[],o=null,s=0;for(let e=1;e<n.length;e++){let t=n[e]??``,r=t.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(r){o&&a.push(o),o={oldStart:parseInt(r[1]??`0`,10),oldLines:parseInt(r[2]??`1`,10),newStart:parseInt(r[3]??`0`,10),newLines:parseInt(r[4]??`1`,10),lines:[]};continue}if(!(t.startsWith(`index `)||t.startsWith(`---`)||t.startsWith(`+++`)||t.startsWith(`new file`)||t.startsWith(`deleted file`)||t.startsWith(`old mode`)||t.startsWith(`new mode`)||t.startsWith(`Binary files`))&&o&&(t.startsWith(`+`)||t.startsWith(`-`)||t.startsWith(` `)||t===``)){if(s>=R)continue;o.lines.push(`${t}`),s++}}o&&a.push(o),a.length>0&&t.set(i,a)}return t}async function P(){let e=await D(x());return e?(await Promise.all([`MERGE_HEAD`,`REBASE_HEAD`,`CHERRY_PICK_HEAD`,`REVERT_HEAD`].map(t=>oe(M(e,t)).then(()=>!0).catch(()=>!1)))).some(Boolean):!1}async function ue(e){let{stdout:t,code:n}=await k(E(),[`--no-optional-locks`,`ls-files`,`--others`,`--exclude-standard`],{timeout:F,preserveOutputOnError:!1});if(n!==0||!t.trim())return null;let r=t.trim().split(`
|
|
4
4
|
`).filter(Boolean);if(r.length===0)return null;let i=new Map;for(let t of r.slice(0,e))i.set(t,{added:0,removed:0,isBinary:!1,isUntracked:!0});return i}function de(e){let t=e.match(/(\d+)\s+files?\s+changed(?:,\s+(\d+)\s+insertions?\(\+\))?(?:,\s+(\d+)\s+deletions?\(-\))?/);return t?{filesCount:parseInt(t[1]??`0`,10),linesAdded:parseInt(t[2]??`0`,10),linesRemoved:parseInt(t[3]??`0`,10)}:null}var F,I,L,R,z,B=e((()=>{b(),ie(),O(),C(),T(),F=5e3,I=50,L=1e6,R=400,z=500}));function V(){let[e,t]=(0,H.useState)(null),[n,r]=(0,H.useState)(new Map),[i,a]=(0,H.useState)(!0);return(0,H.useEffect)(()=>{let e=!1;async function n(){try{let[n,i]=await Promise.all([se(),N()]);e||(t(n),r(i),a(!1))}catch{e||(t(null),r(new Map),a(!1))}}return n(),()=>{e=!0}},[]),(0,H.useMemo)(()=>{if(!e)return{stats:null,files:[],hunks:new Map,loading:i};let{stats:t,perFileStats:r}=e,a=[];for(let[e,t]of r){let r=n.get(e),i=t.isUntracked??!1,o=!t.isBinary&&!i&&!r,s=t.added+t.removed,c=!o&&!t.isBinary&&s>U;a.push({path:e,linesAdded:t.added,linesRemoved:t.removed,isBinary:t.isBinary,isLargeFile:o,isTruncated:c,isUntracked:i})}return a.sort((e,t)=>e.path.localeCompare(t.path)),{stats:t,files:a,hunks:n,loading:!1}},[e,n,i])}var H,U,W=e((()=>{H=t(g(),1),B(),U=400}));function fe(e){if(!e||typeof e!=`object`)return!1;let t=e,n=typeof t.filePath==`string`,r=Array.isArray(t.structuredPatch)&&t.structuredPatch.length>0,i=t.type===`create`&&typeof t.content==`string`;return n&&(r||i)}function pe(e){return`type`in e&&(e.type===`create`||e.type===`update`)}function me(e){let t=0,n=0;for(let r of e)for(let e of r.lines)e.startsWith(`+`)?t++:e.startsWith(`-`)&&n++;return{added:t,removed:n}}function he(e){if(e.type!==`user`)return``;let t=e.message.content,n=typeof t==`string`?t:``;return n.length<=30?n:`${n.slice(0,29)}…`}function G(e){let t=0,n=0;for(let r of e.files.values())t+=r.linesAdded,n+=r.linesRemoved;e.stats={filesChanged:e.files.size,linesAdded:t,linesRemoved:n}}function ge(e){let t=(0,K.useRef)({completedTurns:[],currentTurn:null,lastProcessedIndex:0,lastTurnIndex:0});return(0,K.useMemo)(()=>{let n=t.current;e.length<n.lastProcessedIndex&&(n.completedTurns=[],n.currentTurn=null,n.lastProcessedIndex=0,n.lastTurnIndex=0);for(let t=n.lastProcessedIndex;t<e.length;t++){let r=e[t];if(r?.type===`user`){if(!(r.toolUseResult||Array.isArray(r.message.content)&&r.message.content[0]?.type===`tool_result`)&&!r.isMeta)n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),n.completedTurns.push(n.currentTurn)),n.lastTurnIndex++,n.currentTurn={turnIndex:n.lastTurnIndex,userPromptPreview:he(r),timestamp:r.timestamp,files:new Map,stats:{filesChanged:0,linesAdded:0,linesRemoved:0}};else if(n.currentTurn&&r.toolUseResult){let e=r.toolUseResult;if(fe(e)){let{filePath:t,structuredPatch:r}=e,i=`type`in e&&e.type===`create`,a=n.currentTurn.files.get(t);if(a||(a={filePath:t,hunks:[],isNewFile:i,linesAdded:0,linesRemoved:0},n.currentTurn.files.set(t,a)),i&&r.length===0&&pe(e)){let t=e.content.split(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./Doctor-FPYTivHw.js";e();export{t as Doctor};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$i as o,AT as s,By as c,GC as l,HC as u,H_ as d,Jl as f,KC as p,Ky as m,Lw as ee,OT as h,Qi as g,Qw as _,Rw as v,UC as te,U_ as y,Uy as b,WC as x,Wy as ne,Xh as re,Xl as S,Yl as C,Zh as w,jT as ie,kT as ae,tT as T,uC as oe}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$i as o,AT as s,By as c,GC as l,HC as u,H_ as d,Jl as f,KC as p,Ky as m,Lw as ee,OT as h,Qi as g,Qw as _,Rw as v,UC as te,U_ as y,Uy as b,WC as x,Wy as ne,Xh as re,Xl as S,Yl as C,Zh as w,jT as ie,kT as ae,tT as T,uC as oe}from"./loadAgentsDir-DaNpxaO-.js";import{Gt as se,I as E,P as D,ai as ce,t as O,x as k}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{$ as j,Ut as M}from"./state-D5D6QpTX.js";import{Cn as N,On as P,R as F,V as I}from"./settings-3xZ0fsvE.js";import{l as L,o as R}from"./stringUtils-CKD8qDqx.js";import{Bn as z,Ln as B,_ as V,u as H}from"./model-Do0f476p.js";import{n as U,t as W}from"./ValidationErrorsList-BfZ5gcIv.js";import{f as G,g as le,h as ue,i as de,n as fe,o as pe,p as me,r as he}from"./pidLock-DiKz5Tza.js";import{n as ge,t as _e}from"./useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js";import{n as ve,t as ye}from"./McpParsingWarnings-BUlgpZAF.js";import{n as be,t as xe}from"./PressEnterToContinue-Dwoh6CaW.js";import{n as Se,t as Ce}from"./useSettingsErrors-Dvi6zLCr.js";import{n as we,t as Te}from"./shadowedRuleDetection-Cy9tsuKc.js";import{n as Ee,r as De,t as K}from"./statusNoticeHelpers-CZoOse-_.js";import{join as q}from"path";function Oe(){if(!ie())return null;let e=h();if(e.length===0)return null;let t=e.filter(e=>e.severity===`error`),n=e.filter(e=>e.severity===`warning`);return(0,J.jsxs)(E,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,J.jsx)(D,{bold:!0,color:t.length>0?`error`:`warning`,children:`Keybinding Configuration Issues`}),(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`Location: `}),(0,J.jsx)(D,{dimColor:!0,children:ae()})]}),(0,J.jsxs)(E,{marginLeft:1,flexDirection:`column`,marginTop:1,children:[t.map((e,t)=>(0,J.jsxs)(E,{flexDirection:`column`,children:[(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`└ `}),(0,J.jsx)(D,{color:`error`,children:`[Error]`}),(0,J.jsxs)(D,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(E,{marginLeft:3,children:(0,J.jsxs)(D,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`error-${t}`)),n.map((e,t)=>(0,J.jsxs)(E,{flexDirection:`column`,children:[(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`└ `}),(0,J.jsx)(D,{color:`warning`,children:`[Warning]`}),(0,J.jsxs)(D,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(E,{marginLeft:3,children:(0,J.jsxs)(D,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`warning-${t}`))]})]})}var J,ke=e((()=>{O(),s(),J=A()}));function Ae(){if(!_.isSupportedPlatform()||!_.isSandboxEnabledInSettings())return null;let e=_.checkDependencies(),t=e.errors.length>0,n=e.warnings.length>0;return!t&&!n?null:(0,Y.jsxs)(E,{flexDirection:`column`,children:[(0,Y.jsx)(D,{bold:!0,children:`Sandbox`}),(0,Y.jsxs)(D,{children:[`└ Status: `,(0,Y.jsx)(D,{color:t?`error`:`warning`,children:t?`Missing dependencies`:`Available (with warnings)`})]}),e.errors.map((e,t)=>(0,Y.jsxs)(D,{color:`error`,children:[`└ `,e]},t)),e.warnings.map((e,t)=>(0,Y.jsxs)(D,{color:`warning`,children:[`└ `,e]},t)),t&&(0,Y.jsx)(D,{dimColor:!0,children:`└ Run /sandbox for install instructions`})]})}var Y,je=e((()=>{O(),T(),Y=A()}));async function Me(){let e=b(await ne());if(e.length===0)return null;let t=e.sort((e,t)=>t.content.length-e.content.length).map(e=>`${e.path}: ${e.content.length.toLocaleString()} chars`);return{type:`agentsmd_files`,severity:`warning`,message:e.length===1?`Large AGENTS.md file detected (${e[0].content.length.toLocaleString()} chars > ${c.toLocaleString()})`:`${e.length} large AGENTS.md files detected (each > ${c.toLocaleString()} chars)`,details:t,currentValue:e.length,threshold:c}}async function Ne(e){if(!e)return null;let t=Ee(e);if(t<=15e3)return null;let n=e.activeAgents.filter(e=>e.source!==`built-in`).map(e=>{let t=`${e.agentType}: ${e.whenToUse}`;return{name:e.agentType,tokens:o(t)}}).sort((e,t)=>t.tokens-e.tokens),r=n.slice(0,5).map(e=>`${e.name}: ~${e.tokens.toLocaleString()} tokens`);return n.length>5&&r.push(`(${n.length-5} more custom agents)`),{type:`agent_descriptions`,severity:`warning`,message:`Large agent descriptions (~${t.toLocaleString()} tokens > ${K.toLocaleString()})`,details:r,currentValue:t,threshold:K}}async function X(e,t,n){let r=e.filter(e=>e.isMcp);if(r.length===0)return null;try{let{mcpToolTokens:r,mcpToolDetails:i}=await d(e,t,n,H());if(r<=Z)return null;let a=new Map;for(let e of i){let t=e.name.split(`__`)[1]||`unknown`,n=a.get(t)||{count:0,tokens:0};a.set(t,{count:n.count+1,tokens:n.tokens+e.tokens})}let o=Array.from(a.entries()).sort((e,t)=>t[1].tokens-e[1].tokens),s=o.slice(0,5).map(([e,t])=>`${e}: ${t.count} tools (~${t.tokens.toLocaleString()} tokens)`);return o.length>5&&s.push(`(${o.length-5} more servers)`),{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${r.toLocaleString()} tokens > ${Z.toLocaleString()})`,details:s,currentValue:r,threshold:Z}}catch{let e=r.reduce((e,t)=>e+o(((t.name?.length||0)+t.description.length).toString()),0);return e<=Z?null:{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${e.toLocaleString()} tokens estimated > ${Z.toLocaleString()})`,details:[`${r.length} MCP tools detected (token count estimated)`],currentValue:e,threshold:Z}}}async function Pe(e){let t=Te(await e(),{sandboxAutoAllowEnabled:_.isSandboxingEnabled()&&_.isAutoAllowBashIfSandboxedEnabled()});if(t.length===0)return null;let n=t.flatMap(e=>[`${I(e.rule.ruleValue)}: ${e.reason}`,` Fix: ${e.fix}`]);return{type:`unreachable_rules`,severity:`warning`,message:`${t.length} ${L(t.length,`unreachable permission rule`)} detected`,details:n,currentValue:t.length,threshold:0}}async function Fe(e,t,n){let[r,i,a,o]=await Promise.all([Me(),Ne(t),X(e,n,t),Pe(n)]);return{agentsMdWarning:r,agentWarning:i,mcpWarning:a,unreachableRulesWarning:o}}var Z,Ie=e((()=>{g(),y(),m(),V(),F(),we(),T(),De(),R(),Z=25e3}));function Le({onDone:e}){let t=w(e=>e.agentDefinitions),r=w(e=>e.mcp.tools),i=w(e=>e.toolPermissionContext),o=w(e=>e.plugins.errors);ge();let s=(0,Q.useMemo)(()=>r||[],[r]),[c,l]=(0,Q.useState)(null),[d,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),y=Se().filter(e=>e.mcpErrorMetadata===void 0),b=(0,Q.useMemo)(()=>[{name:`BASH_MAX_OUTPUT_LENGTH`,default:u,upperLimit:te},{name:`TASK_MAX_OUTPUT_LENGTH`,default:f,upperLimit:C},{name:`CLAUDE_CODE_MAX_OUTPUT_TOKENS`,...B(`claude-opus-4-7`)}].map(e=>{let t=process.env[e.name],n=p(e.name,t,e.default,e.upperLimit);return{name:e.name,...n}}).filter(e=>e.status!==`valid`),[]);(0,Q.useEffect)(()=>{ue().then(l),(async()=>{let e=q(n(),`agents`),r=q(j(),`.workmate`,`agents`),{activeAgents:a,allAgents:o,failedFiles:c}=t,[l,u]=await Promise.all([P(e),P(r)]),d={activeAgents:a.map(e=>({agentType:e.agentType,source:e.source})),userAgentsDir:e,projectAgentsDir:r,userDirExists:l,projectDirExists:u,failedFiles:c};m(d);let f=await Fe(s,{activeAgents:a,allAgents:o,failedFiles:c},async()=>i);if(g(f),pe()){let e=q(G(),`claude`,`locks`),t=fe(e),n=he(e);v({enabled:!0,locks:n,locksDir:e,staleLocksCleaned:t})}else v({enabled:!1,locks:[],locksDir:``,staleLocksCleaned:0})})()},[i,s,t]);let x=(0,Q.useCallback)(()=>{e(`Work Mate diagnostics dismissed`,{display:`system`})},[e]);return se({"confirm:yes":x,"confirm:no":x},{context:`Confirmation`}),c?(0,$.jsxs)(k,{children:[(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Diagnostics`}),(0,$.jsxs)(D,{children:[`└ Currently running: `,c.installationType,` (`,c.version,`)`]}),c.packageManager&&(0,$.jsxs)(D,{children:[`└ Package manager: `,c.packageManager]}),(0,$.jsxs)(D,{children:[`└ Path: `,c.installationPath]}),(0,$.jsxs)(D,{children:[`└ Invoked: `,c.invokedBinary]}),(0,$.jsxs)(D,{children:[`└ Config install method: `,c.configInstallMethod]}),(0,$.jsxs)(D,{children:[`└ Search: `,c.ripgrepStatus.working?`OK`:`Not working`,` (`,c.ripgrepStatus.mode===`embedded`?`bundled`:c.ripgrepStatus.mode===`builtin`?`vendor`:c.ripgrepStatus.systemPath||`system`,`)`]}),c.ripgrepStatus.note&&(0,$.jsxs)(D,{color:`warning`,children:[`└ Note: `,c.ripgrepStatus.note]}),c.recommendation&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),(0,$.jsxs)(D,{color:`warning`,children:[`Recommendation: `,c.recommendation.split(`
|
|
2
2
|
`)[0]]}),(0,$.jsx)(D,{dimColor:!0,children:c.recommendation.split(`
|
|
3
3
|
`)[1]})]}),c.multipleInstallations.length>1&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),(0,$.jsx)(D,{color:`warning`,children:`Warning: Multiple installations found`}),c.multipleInstallations.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.type,` at `,e.path]},t))]}),c.warnings.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),c.warnings.map((e,t)=>(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsxs)(D,{color:`warning`,children:[`Warning: `,e.issue]}),(0,$.jsxs)(D,{children:[`Fix: `,e.fix]})]},t))]}),y.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,$.jsx)(D,{bold:!0,children:`Invalid Settings`}),(0,$.jsx)(W,{errors:y})]})]}),(0,$.jsx)(Ae,{}),(0,$.jsx)(ye,{}),(0,$.jsx)(Oe,{}),b.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Environment Variables`}),b.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.name,`:`,` `,(0,$.jsx)(D,{color:e.status===`capped`?`warning`:`error`,children:e.message})]},t))]}),_?.enabled&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Version Locks`}),_.staleLocksCleaned>0&&(0,$.jsxs)(D,{dimColor:!0,children:[`└ Cleaned `,_.staleLocksCleaned,` stale lock(s)`]}),_.locks.length===0?(0,$.jsx)(D,{dimColor:!0,children:`└ No active version locks`}):_.locks.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.version,`: PID `,e.pid,` `,e.isProcessRunning?(0,$.jsx)(D,{children:`(running)`}):(0,$.jsx)(D,{color:`warning`,children:`(stale)`})]},t))]}),d?.failedFiles&&d.failedFiles.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`error`,children:`Agent Parse Errors`}),(0,$.jsxs)(D,{color:`error`,children:[`└ Failed to parse `,d.failedFiles.length,` agent file(s):`]}),d.failedFiles.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e.path,`: `,e.error]},t))]}),o.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`error`,children:`Plugin Errors`}),(0,$.jsxs)(D,{color:`error`,children:[`└ `,o.length,` plugin error(s) detected:`]}),o.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e.source||`unknown`,`plugin`in e&&e.plugin?` [${e.plugin}]`:``,`: `,ee(e)]},t))]}),h?.unreachableRulesWarning&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`warning`,children:`Unreachable Permission Rules`}),(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.unreachableRulesWarning.message]})]}),h.unreachableRulesWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),h&&(h.agentsMdWarning||h.agentWarning||h.mcpWarning)&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Context Usage Warnings`}),h.agentsMdWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.agentsMdWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ Files:`]}),h.agentsMdWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),h.agentWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.agentWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ Top contributors:`]}),h.agentWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),h.mcpWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.mcpWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ MCP servers:`]}),h.mcpWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]})]}),(0,$.jsx)(E,{children:(0,$.jsx)(xe,{})})]}):(0,$.jsx)(k,{children:(0,$.jsx)(D,{dimColor:!0,children:`Checking installation status…`})})}var Q,$,Re=e((()=>{i(),Q=t(ce(),1),ke(),ve(),z(),r(),M(),O(),be(),je(),U(),Ce(),_e(),oe(),re(),v(),Ie(),le(),l(),N(),de(),x(),S(),me(),$=A()}));export{Re as n,Le as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as r,$u as i,AC as a,JT as o,Mu as s,Pu as c,Qu as l,St as u,Tt as d,YT as f,Zd as p,br as m,fT as h,ft as g,kC as _,mi as v,pT as y,wt as b,yt as x}from"./loadAgentsDir-
|
|
1
|
+
import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as r,$u as i,AC as a,JT as o,Mu as s,Pu as c,Qu as l,St as u,Tt as d,YT as f,Zd as p,br as m,fT as h,ft as g,kC as _,mi as v,pT as y,wt as b,yt as x}from"./loadAgentsDir-DaNpxaO-.js";import{I as S,P as C,ai as w,t as T,y as E}from"./src-DL3w8VPk2.js";import{t as D}from"./jsx-runtime-Bb4Xn-E0.js";import{c as O,i as k}from"./debug-D58GQBDG.js";import{r as A,t as j}from"./execFileNoThrow-Bmb5HEFz.js";import{n as M,r as N}from"./analytics-DJobLaWP.js";function P(){(m(),e(v)).saveWorktreeState(null)}function F({onDone:e,onCancel:t}){let[n,r]=(0,I.useState)(`loading`),[i,c]=(0,I.useState)([]),[u,f]=(0,I.useState)(0),[p,m]=(0,I.useState)(),h=x();if((0,I.useEffect)(()=>{async function e(){let e=[],t=await j(`git`,[`status`,`--porcelain`]);if(t.stdout&&(e=t.stdout.split(`
|
|
2
2
|
`).filter(e=>e.trim()!==``),c(e)),h){let{stdout:t}=await j(`git`,[`rev-list`,`--count`,`${h.originalHeadCommit}..HEAD`]),n=parseInt(t.trim(),10)||0;if(f(n),e.length===0&&n===0){r(`removing`),g().then(()=>{process.chdir(h.originalCwd),a(h.originalCwd),P(),o.cache.clear?.(),m(`Worktree removed (no changes)`)}).catch(e=>{O(`Failed to clean up worktree: ${e}`,{level:`error`}),m(`Worktree cleanup failed, exiting anyway`)}).then(()=>{r(`done`)});return}else r(`asking`)}}e()},[h]),(0,I.useEffect)(()=>{n===`done`&&e(p)},[n,e,p]),!h)return e(`No active worktree session found`,{display:`system`}),null;if(n===`loading`||n===`done`)return null;async function _(e){if(!h)return;let t=!!h.tmuxSessionName;if(e===`keep`||e===`keep-with-tmux`)r(`keeping`),N(`tengu_worktree_kept`,{commits:u,changed_files:i.length}),await b(),process.chdir(h.originalCwd),a(h.originalCwd),P(),o.cache.clear?.(),m(t?`Worktree kept. Your work is saved at ${h.worktreePath} on branch ${h.worktreeBranch}. Reattach to tmux session with: tmux attach -t ${h.tmuxSessionName}`:`Worktree kept. Your work is saved at ${h.worktreePath} on branch ${h.worktreeBranch}`),r(`done`);else if(e===`keep-kill-tmux`)r(`keeping`),N(`tengu_worktree_kept`,{commits:u,changed_files:i.length}),h.tmuxSessionName&&await d(h.tmuxSessionName),await b(),process.chdir(h.originalCwd),a(h.originalCwd),P(),o.cache.clear?.(),m(`Worktree kept at ${h.worktreePath} on branch ${h.worktreeBranch}. Tmux session terminated.`),r(`done`);else if(e===`remove`||e===`remove-with-tmux`){r(`removing`),N(`tengu_worktree_removed`,{commits:u,changed_files:i.length}),h.tmuxSessionName&&await d(h.tmuxSessionName);try{await g(),process.chdir(h.originalCwd),a(h.originalCwd),P(),o.cache.clear?.()}catch(e){O(`Failed to clean up worktree: ${e}`,{level:`error`}),m(`Worktree cleanup failed, exiting anyway`),r(`done`);return}let e=t?` Tmux session terminated.`:``;u>0&&i.length>0?m(`Worktree removed. ${u} ${u===1?`commit`:`commits`} and uncommitted changes were discarded.${e}`):u>0?m(`Worktree removed. ${u} ${u===1?`commit`:`commits`} on ${h.worktreeBranch} ${u===1?`was`:`were`} discarded.${e}`):i.length>0?m(`Worktree removed. Uncommitted changes were discarded.${e}`):m(`Worktree removed.${e}`),r(`done`)}}if(n===`keeping`)return(0,L.jsxs)(S,{flexDirection:`row`,marginY:1,children:[(0,L.jsx)(s,{}),(0,L.jsx)(C,{children:`Keeping worktree…`})]});if(n===`removing`)return(0,L.jsxs)(S,{flexDirection:`row`,marginY:1,children:[(0,L.jsx)(s,{}),(0,L.jsx)(C,{children:`Removing worktree…`})]});let v=h.worktreeBranch,y=i.length>0,w=u>0,T=``;T=y&&w?`You have ${i.length} uncommitted ${i.length===1?`file`:`files`} and ${u} ${u===1?`commit`:`commits`} on ${v}. All will be lost if you remove.`:y?`You have ${i.length} uncommitted ${i.length===1?`file`:`files`}. These will be lost if you remove the worktree.`:w?`You have ${u} ${u===1?`commit`:`commits`} on ${v}. The branch will be deleted if you remove the worktree.`:`You are working in a worktree. Keep it to continue working there, or remove it to clean up.`;function D(){if(t){t();return}_(`keep`)}let k=y||w?`All changes and commits will be lost.`:`Clean up the worktree directory.`,A=!!h.tmuxSessionName,M=A?[{label:`Keep worktree and tmux session`,value:`keep-with-tmux`,description:`Stays at ${h.worktreePath}. Reattach with: tmux attach -t ${h.tmuxSessionName}`},{label:`Keep worktree, kill tmux session`,value:`keep-kill-tmux`,description:`Keeps worktree at ${h.worktreePath}, terminates tmux session.`},{label:`Remove worktree and tmux session`,value:`remove-with-tmux`,description:k}]:[{label:`Keep worktree`,value:`keep`,description:`Stays at ${h.worktreePath}`},{label:`Remove worktree`,value:`remove`,description:k}];return(0,L.jsx)(E,{title:`Exiting worktree session`,subtitle:T,onCancel:D,children:(0,L.jsx)(l,{defaultFocusValue:A?`keep-with-tmux`:`keep`,options:M,onChange:_})})}var I,L,R=t((()=>{I=n(w(),1),M(),k(),T(),A(),f(),_(),u(),i(),c(),L=D()}));function z(){return y(H)??`Goodbye!`}function B({showWorktree:e,onDone:t,onCancel:n}){async function r(e){t(e??z()),await p(0,`prompt_input_exit`)}return e?(0,V.jsx)(F,{onDone:r,onCancel:n}):null}var V,H,U=t((()=>{h(),r(),R(),V=D(),H=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}));export{U as n,B as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Qu as t,Zu as n}from"./loadAgentsDir-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Qu as t,Zu as n}from"./loadAgentsDir-DaNpxaO-.js";import{D as r,I as i,Lt as a,P as o,T as s,ai as c,t as l,y as u}from"./src-DL3w8VPk2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{n as f,r as p}from"./analytics-DJobLaWP.js";import{i as m,o as h,r as g,s as _,t as v}from"./grove-CYE1Cfcz.js";var y=e(c(),1);f(),l(),n();var b=d(),x=` _____________
|
|
2
2
|
| \\ \\
|
|
3
3
|
| NEW TERMS \\__\\
|
|
4
4
|
| |
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{l as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{JC as o,qC as s}from"./loadAgentsDir-
|
|
1
|
+
import{l as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{JC as o,qC as s}from"./loadAgentsDir-DaNpxaO-.js";import{C as c,c as l,i as u,x as d}from"./debug-D58GQBDG.js";import{O as f,k as p}from"./git-By_J4XJL.js";import{n as m,r as h}from"./analytics-DJobLaWP.js";import{c as g,h as _,l as v,m as y,s as b}from"./proxy-BhIc7-mj.js";import{C as x,S,f as C,g as w,u as T}from"./sessionState-CQhbGfmh.js";import{n as E,t as D}from"./rcDebugLog-DSchf3Hs.js";import{r as O}from"./ccrClient-DO563xlf.js";a(),x(),m(),o(),u(),D(),f(),t(),_(),v(),T(),d(),n();var k=`{"type":"keep_alive"}
|
|
2
2
|
`,A=1e3,j=1e3,M=3e4,N=6e5,P=1e4,F=12e4,I=M*2,L=new Set([1002,4001,4003]),R=class{constructor(e,t={},n,i,a){r(this,`ws`,null),r(this,`lastSentId`,null),r(this,`url`,void 0),r(this,`state`,`idle`),r(this,`onData`,void 0),r(this,`onCloseCallback`,void 0),r(this,`onConnectCallback`,void 0),r(this,`headers`,void 0),r(this,`sessionId`,void 0),r(this,`autoReconnect`,void 0),r(this,`isBridge`,void 0),r(this,`reconnectAttempts`,0),r(this,`reconnectStartTime`,null),r(this,`reconnectTimer`,null),r(this,`lastReconnectAttemptTime`,null),r(this,`lastActivityTime`,0),r(this,`pingInterval`,null),r(this,`pongReceived`,!0),r(this,`keepAliveInterval`,null),r(this,`messageBuffer`,void 0),r(this,`isBunWs`,!1),r(this,`connectStartTime`,0),r(this,`refreshHeaders`,void 0),r(this,`onBunOpen`,()=>{this.handleOpenEvent(),this.lastSentId&&this.replayBufferedMessages(``)}),r(this,`onBunMessage`,e=>{let t=typeof e.data==`string`?e.data:String(e.data);this.lastActivityTime=Date.now(),p(`info`,`cli_websocket_message_received`,{length:t.length}),this.onData&&this.onData(t)}),r(this,`onBunError`,()=>{l(`WebSocketTransport: Error`,{level:`error`}),p(`error`,`cli_websocket_connect_error`)}),r(this,`onBunClose`,e=>{let t=e.code===1e3||e.code===1001;l(`WebSocketTransport: Closed: ${e.code}`,t?void 0:{level:`error`}),p(`error`,`cli_websocket_connect_closed`),this.handleConnectionError(e.code)}),r(this,`onNodeOpen`,()=>{let e=this.ws;if(this.handleOpenEvent(),!e)return;let t=e.upgradeReq;if(t?.headers?.[`x-last-request-id`]){let e=t.headers[`x-last-request-id`];this.replayBufferedMessages(e)}}),r(this,`onNodeMessage`,e=>{let t=e.toString();this.lastActivityTime=Date.now(),p(`info`,`cli_websocket_message_received`,{length:t.length}),this.onData&&this.onData(t)}),r(this,`onNodeError`,e=>{l(`WebSocketTransport: Error: ${e.message}`,{level:`error`}),p(`error`,`cli_websocket_connect_error`)}),r(this,`onNodeClose`,(e,t)=>{let n=e===1e3||e===1001;l(`WebSocketTransport: Closed: ${e}`,n?void 0:{level:`error`}),p(`error`,`cli_websocket_connect_closed`),this.handleConnectionError(e)}),r(this,`onPong`,()=>{this.pongReceived=!0}),this.url=e,this.headers=t,this.sessionId=n,this.refreshHeaders=i,this.autoReconnect=a?.autoReconnect??!0,this.isBridge=a?.isBridge??!1,this.messageBuffer=new s(A)}async connect(){if(this.state!==`idle`&&this.state!==`reconnecting`){l(`WebSocketTransport: Cannot connect, current state is ${this.state}`,{level:`error`}),p(`error`,`cli_websocket_connect_failed`);return}this.state=`reconnecting`,this.connectStartTime=Date.now(),l(`WebSocketTransport: Opening ${this.url.href}`),p(`info`,`cli_websocket_connect_opening`);let e={...this.headers};if(this.lastSentId&&(e[`X-Last-Request-Id`]=this.lastSentId,l(`WebSocketTransport: Adding X-Last-Request-Id header: ${this.lastSentId}`)),typeof Bun<`u`){let t=new globalThis.WebSocket(this.url.href,{headers:e,proxy:g(this.url.href),tls:y()||void 0});this.ws=t,this.isBunWs=!0,t.addEventListener(`open`,this.onBunOpen),t.addEventListener(`message`,this.onBunMessage),t.addEventListener(`error`,this.onBunError),t.addEventListener(`close`,this.onBunClose),t.addEventListener(`pong`,this.onPong)}else{let{default:t}=await import(`./wrapper-K8ZapJVu.js`),n=new t(this.url.href,{headers:e,agent:b(this.url.href),...y()});this.ws=n,this.isBunWs=!1,n.on(`open`,this.onNodeOpen),n.on(`message`,this.onNodeMessage),n.on(`error`,this.onNodeError),n.on(`close`,this.onNodeClose),n.on(`pong`,this.onPong)}}handleOpenEvent(){let e=Date.now()-this.connectStartTime;l(`WebSocketTransport: Connected`),p(`info`,`cli_websocket_connect_connected`,{duration_ms:e}),this.isBridge&&this.reconnectStartTime!==null&&h(`tengu_ws_transport_reconnected`,{attempts:this.reconnectAttempts,downtimeMs:Date.now()-this.reconnectStartTime}),this.reconnectAttempts=0,this.reconnectStartTime=null,this.lastReconnectAttemptTime=null,this.lastActivityTime=Date.now(),this.state=`connected`,this.onConnectCallback?.(),this.startPingInterval(),this.startKeepaliveInterval(),C(()=>{this.write({type:`keep_alive`})})}sendLine(e){if(!this.ws||this.state!==`connected`)return l(`WebSocketTransport: Not connected`),p(`info`,`cli_websocket_send_not_connected`),!1;try{return this.ws.send(e),this.lastActivityTime=Date.now(),!0}catch(e){return l(`WebSocketTransport: Failed to send: ${e}`,{level:`error`}),p(`error`,`cli_websocket_send_error`),this.handleConnectionError(),!1}}removeWsListeners(e){if(this.isBunWs){let t=e;t.removeEventListener(`open`,this.onBunOpen),t.removeEventListener(`message`,this.onBunMessage),t.removeEventListener(`error`,this.onBunError),t.removeEventListener(`close`,this.onBunClose),t.removeEventListener(`pong`,this.onPong)}else{let t=e;t.off(`open`,this.onNodeOpen),t.off(`message`,this.onNodeMessage),t.off(`error`,this.onNodeError),t.off(`close`,this.onNodeClose),t.off(`pong`,this.onPong)}}doDisconnect(){this.stopPingInterval(),this.stopKeepaliveInterval(),w(),this.ws&&(this.removeWsListeners(this.ws),this.ws.close(),this.ws=null)}handleConnectionError(e){if(E(`WS handleConnectionError: code=${e} state=${this.state} url=${this.url.href.replace(/token=[^&]+/,`token=***`)} msSinceLastActivity=${this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1} reconnectAttempts=${this.reconnectAttempts}`),l(`WebSocketTransport: Disconnected from ${this.url.href}`+(e==null?``:` (code ${e})`)),p(`info`,`cli_websocket_disconnected`),this.isBridge&&h(`tengu_ws_transport_closed`,{closeCode:e,msSinceLastActivity:this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1,wasConnected:this.state===`connected`,reconnectAttempts:this.reconnectAttempts}),this.doDisconnect(),this.state===`closing`||this.state===`closed`)return;let t=!1;if(e===4003&&this.refreshHeaders){let e=this.refreshHeaders();e.Authorization!==this.headers.Authorization&&(Object.assign(this.headers,e),t=!0,l(`WebSocketTransport: 4003 received but headers refreshed, scheduling reconnect`),p(`info`,`cli_websocket_4003_token_refreshed`))}if(e!=null&&L.has(e)&&!t){l(`WebSocketTransport: Permanent close code ${e}, not reconnecting`,{level:`error`}),p(`error`,`cli_websocket_permanent_close`,{closeCode:e}),this.state=`closed`,this.onCloseCallback?.(e);return}if(!this.autoReconnect){this.state=`closed`,this.onCloseCallback?.(e);return}let n=Date.now();this.reconnectStartTime||(this.reconnectStartTime=n),this.lastReconnectAttemptTime!==null&&n-this.lastReconnectAttemptTime>I&&(l(`WebSocketTransport: Detected system sleep (${Math.round((n-this.lastReconnectAttemptTime)/1e3)}s gap), resetting reconnection budget`),p(`info`,`cli_websocket_sleep_detected`,{gapMs:n-this.lastReconnectAttemptTime}),this.reconnectStartTime=n,this.reconnectAttempts=0),this.lastReconnectAttemptTime=n;let r=n-this.reconnectStartTime;if(r<N){if(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),!t&&this.refreshHeaders){let e=this.refreshHeaders();Object.assign(this.headers,e),l(`WebSocketTransport: Refreshed headers for reconnect`)}this.state=`reconnecting`,this.reconnectAttempts++;let e=Math.min(j*2**(this.reconnectAttempts-1),M),n=Math.max(0,e+e*.25*(2*Math.random()-1));l(`WebSocketTransport: Reconnecting in ${Math.round(n)}ms (attempt ${this.reconnectAttempts}, ${Math.round(r/1e3)}s elapsed)`),p(`error`,`cli_websocket_reconnect_attempt`,{reconnectAttempts:this.reconnectAttempts}),this.isBridge&&h(`tengu_ws_transport_reconnecting`,{attempt:this.reconnectAttempts,elapsedMs:r,delayMs:Math.round(n)}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}else l(`WebSocketTransport: Reconnection time budget exhausted after ${Math.round(r/1e3)}s for ${this.url.href}`,{level:`error`}),p(`error`,`cli_websocket_reconnect_exhausted`,{reconnectAttempts:this.reconnectAttempts,elapsedMs:r}),this.state=`closed`,this.onCloseCallback&&this.onCloseCallback(e)}close(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopPingInterval(),this.stopKeepaliveInterval(),w(),this.state=`closing`,this.doDisconnect()}replayBufferedMessages(e){let t=this.messageBuffer.toArray();if(t.length===0)return;let n=0;if(e){let r=t.findIndex(t=>`uuid`in t&&t.uuid===e);if(r>=0){n=r+1;let e=t.slice(n);this.messageBuffer.clear(),this.messageBuffer.addAll(e),e.length===0&&(this.lastSentId=null),l(`WebSocketTransport: Evicted ${n} confirmed messages, ${e.length} remaining`),p(`info`,`cli_websocket_evicted_confirmed_messages`,{evicted:n,remaining:e.length})}}let r=t.slice(n);if(r.length===0){l(`WebSocketTransport: No new messages to replay`),p(`info`,`cli_websocket_no_messages_to_replay`);return}l(`WebSocketTransport: Replaying ${r.length} buffered messages`),p(`info`,`cli_websocket_messages_to_replay`,{count:r.length});for(let e of r){let t=`${c(e)}\n`;if(!this.sendLine(t)){this.handleConnectionError();break}}}isConnectedStatus(){return this.state===`connected`}isClosedStatus(){return this.state===`closed`}setOnData(e){this.onData=e}setOnConnect(e){this.onConnectCallback=e}setOnClose(e){this.onCloseCallback=e}getStateLabel(){return this.state}async write(e){`uuid`in e&&typeof e.uuid==`string`&&(this.messageBuffer.add(e),this.lastSentId=e.uuid);let t=`${c(e)}\n`;if(this.state!==`connected`)return;let n=this.sessionId?` session=${this.sessionId}`:``,r=this.getControlMessageDetailLabel(e);l(`WebSocketTransport: Sending message type=${e.type}${n}${r}`),this.sendLine(t)}getControlMessageDetailLabel(e){if(e.type===`control_request`){let{request_id:t,request:n}=e,r=n.subtype===`can_use_tool`?n.tool_name:``;return` subtype=${n.subtype} request_id=${t}${r?` tool=${r}`:``}`}if(e.type===`control_response`){let{subtype:t,request_id:n}=e.response;return` subtype=${t} request_id=${n}`}return``}startPingInterval(){this.stopPingInterval(),this.pongReceived=!0;let e=Date.now();this.pingInterval=setInterval(()=>{if(this.state===`connected`&&this.ws){let t=Date.now(),n=t-e;if(e=t,n>I){l(`WebSocketTransport: ${Math.round(n/1e3)}s tick gap detected — process was suspended, forcing reconnect`),p(`info`,`cli_websocket_sleep_detected_on_ping`,{gapMs:n}),this.handleConnectionError();return}if(!this.pongReceived){l(`WebSocketTransport: No pong received, connection appears dead`,{level:`error`}),p(`error`,`cli_websocket_pong_timeout`),this.handleConnectionError();return}this.pongReceived=!1;try{this.ws.ping?.()}catch(e){l(`WebSocketTransport: Ping failed: ${e}`,{level:`error`}),p(`error`,`cli_websocket_ping_failed`)}}},P)}stopPingInterval(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null)}startKeepaliveInterval(){this.stopKeepaliveInterval(),!e(process.env.CLAUDE_CODE_REMOTE)&&(this.keepAliveInterval=setInterval(()=>{if(this.state===`connected`&&this.ws)try{this.ws.send(k),this.lastActivityTime=Date.now(),l(`WebSocketTransport: Sent periodic keep_alive data frame`)}catch(e){l(`WebSocketTransport: Periodic keep_alive failed: ${e}`,{level:`error`}),p(`error`,`cli_websocket_keepalive_failed`)}},F))}stopKeepaliveInterval(){this.keepAliveInterval&&(clearInterval(this.keepAliveInterval),this.keepAliveInterval=null)}};u(),D(),f(),n();var z=100,B=15e3,V=3e3,H=class extends R{constructor(e,t={},n,i,a){super(e,t,n,i,a),r(this,`postUrl`,void 0),r(this,`uploader`,void 0),r(this,`streamEventBuffer`,[]),r(this,`streamEventTimer`,null);let{maxConsecutiveFailures:o,onBatchDropped:s}=a??{};this.postUrl=U(e),this.uploader=new O({maxBatchSize:500,maxQueueSize:1e4,baseDelayMs:500,maxDelayMs:8e3,jitterMs:1e3,maxConsecutiveFailures:o,onBatchDropped:(e,t)=>{p(`error`,`cli_hybrid_batch_dropped_max_failures`,{batchSize:e,failures:t}),s?.(e,t)},send:e=>this.postOnce(e)}),l(`HybridTransport: POST URL = ${this.postUrl}`),p(`info`,`cli_hybrid_transport_initialized`)}async write(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>this.flushStreamEvents(),z));return}return await this.uploader.enqueue([...this.takeStreamEvents(),e]),this.uploader.flush()}async writeBatch(e){return await this.uploader.enqueue([...this.takeStreamEvents(),...e]),this.uploader.flush()}get droppedBatchCount(){return this.uploader.droppedBatchCount}flush(){return this.uploader.enqueue(this.takeStreamEvents()),this.uploader.flush()}takeStreamEvents(){this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null);let e=this.streamEventBuffer;return this.streamEventBuffer=[],e}flushStreamEvents(){this.streamEventTimer=null,this.uploader.enqueue(this.takeStreamEvents())}close(){this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[];let e=this.uploader,t;Promise.race([e.flush(),new Promise(e=>{t=setTimeout(e,V)})]).finally(()=>{clearTimeout(t),e.close()}),super.close()}async postOnce(e){let t=S();if(!t){l(`HybridTransport: No session token available for POST`),p(`warn`,`cli_hybrid_post_no_token`);return}let n={Authorization:`Bearer ${t}`,"Content-Type":`application/json`},r;try{r=await i.post(this.postUrl,{events:e},{headers:n,validateStatus:()=>!0,timeout:B})}catch(e){throw l(`HybridTransport: POST error: ${e.message}`),p(`warn`,`cli_hybrid_post_network_error`),e}if(r.status>=200&&r.status<300){l(`HybridTransport: POST success count=${e.length}`);return}if(r.status>=400&&r.status<500&&r.status!==429){E(`Hybrid POST ${r.status}: url=${this.postUrl.replace(/token=[^&]+/,`token=***`)} events=${e.length} body=${JSON.stringify(r.data).slice(0,200)}`),l(`HybridTransport: POST returned ${r.status} (permanent), dropping`),p(`warn`,`cli_hybrid_post_client_error`,{status:r.status});return}throw l(`HybridTransport: POST returned ${r.status} (retryable)`),p(`warn`,`cli_hybrid_post_retryable_error`,{status:r.status}),Error(`POST failed with ${r.status}`)}};function U(e){let t=e.protocol===`wss:`?`https:`:`http:`,n=e.pathname;return n=n.replace(`/ws/`,`/session/`),n.endsWith(`/events`)||(n=n.endsWith(`/`)?`${n}events`:`${n}/events`),`${t}//${e.host}${n}${e.search}`}export{R as n,H as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ou as e,Qu as t,Xh as n,Yh as r,Zu as i,ku as a}from"./loadAgentsDir-
|
|
1
|
+
import{Ou as e,Qu as t,Xh as n,Yh as r,Zu as i,ku as a}from"./loadAgentsDir-DaNpxaO-.js";import{I as o,P as s,kn as c,t as l,y as u}from"./src-DL3w8VPk2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{C as f,T as p,x as m}from"./debug-D58GQBDG.js";import{t as h}from"./renderOptions-D-aQZbzS.js";l(),a(),n(),m(),i();var g=d();function _({filePath:e,errorDescription:n,onExit:r,onReset:i}){return(0,g.jsxs)(u,{title:`Configuration Error`,color:`error`,onCancel:r,children:[(0,g.jsxs)(o,{flexDirection:`column`,gap:1,children:[(0,g.jsxs)(s,{children:[`The configuration file at `,(0,g.jsx)(s,{bold:!0,children:e}),` contains invalid JSON.`]}),(0,g.jsx)(s,{children:n})]}),(0,g.jsxs)(o,{flexDirection:`column`,children:[(0,g.jsx)(s,{bold:!0,children:`Choose an option:`}),(0,g.jsx)(t,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Reset with default configuration`,value:`reset`}],onChange:e=>{e===`exit`?r():i()},onCancel:r})]})]})}var v=`dark`;async function y({error:t}){let n={...h(!1),theme:v};await new Promise(async i=>{let{unmount:a}=await c((0,g.jsx)(r,{children:(0,g.jsx)(e,{children:(0,g.jsx)(_,{filePath:t.filePath,errorDescription:t.message,onExit:()=>{a(),i(),process.exit(1)},onReset:()=>{p(t.filePath,f(t.defaultConfig,null,2),{flush:!1,encoding:`utf8`}),a(),i(),process.exit(0)}})})}),n)})}export{y as showInvalidConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Qu as e,Zu as t}from"./loadAgentsDir-
|
|
1
|
+
import{Qu as e,Zu as t}from"./loadAgentsDir-DaNpxaO-.js";import{P as n,t as r,y as i}from"./src-DL3w8VPk2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{n as o,t as s}from"./ValidationErrorsList-BfZ5gcIv.js";r(),t(),o();var c=a();function l({settingsErrors:t,onContinue:r,onExit:a}){function o(e){e===`exit`?a():r()}return(0,c.jsxs)(i,{title:`Settings Error`,onCancel:a,color:`warning`,children:[(0,c.jsx)(s,{errors:t}),(0,c.jsx)(n,{dimColor:!0,children:`Files with errors are skipped entirely, not just the invalid settings.`}),(0,c.jsx)(e,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Continue without these settings`,value:`continue`}],onChange:o})]})}export{l as InvalidSettingsDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$h as n,Ab as r,Ax as i,BS as a,Bx as o,Cb as s,Cx as c,Eb as l,IS as u,Ix as d,LS as f,Lx as p,Mx as m,Ob as h,Qh as ee,Rx as g,Sb as _,Tb as v,Tx as te,VS as y,Xd as b,Xh as x,Yd as ne,Zh as S,ax as C,dx as re,hT as w,jb as T,jx as E,mT as D,vx as O,wx as ie,xb as k,yb as A}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$h as n,Ab as r,Ax as i,BS as a,Bx as o,Cb as s,Cx as c,Eb as l,IS as u,Ix as d,LS as f,Lx as p,Mx as m,Ob as h,Qh as ee,Rx as g,Sb as _,Tb as v,Tx as te,VS as y,Xd as b,Xh as x,Yd as ne,Zh as S,ax as C,dx as re,hT as w,jb as T,jx as E,mT as D,vx as O,wx as ie,xb as k,yb as A}from"./loadAgentsDir-DaNpxaO-.js";import{ai as j}from"./src-DL3w8VPk2.js";import{t as M}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as N,ft as ae}from"./state-D5D6QpTX.js";import{P,R as oe,c as se,i as ce}from"./debug-D58GQBDG.js";import{rt as F,tt as I}from"./settings-3xZ0fsvE.js";import{c as L,l as R,o as z}from"./log-CZ7ploQm.js";import{n as B,r as V}from"./analytics-DJobLaWP.js";import{o as H,t as U}from"./localSearch-C2SZ9bGW.js";import{n as W,t as le}from"./omit-DO61BHZu.js";function G(e){let t=`plugin`in e?e.plugin:`no-plugin`;return`${e.type}:${e.source}:${t}`}function K(e,t){t.length!==0&&e(e=>{let n=new Set(e.plugins.errors.map(e=>G(e))),r=t.filter(e=>!n.has(G(e)));return r.length===0?e:{...e,plugins:{...e.plugins,errors:[...e.plugins.errors,...r]}}})}function ue(e,t=!1){let r=ee(),o=S(e=>e.authVersion),l=S(e=>e.mcp.pluginReconnectKey),y=n(),x=(0,q.useRef)(new Map),{addNotification:ne}=b(),E=(0,q.useRef)([]),D=(0,q.useRef)(null),O=(0,q.useCallback)(()=>{D.current=null;let e=E.current;e.length!==0&&(E.current=[],y(t=>{let n=t.mcp;for(let t of e){let{tools:e,commands:r,resources:i,...a}=t,o=a.type===`disabled`||a.type===`failed`?e??[]:e,s=a.type===`disabled`||a.type===`failed`?r??[]:r,c=a.type===`disabled`||a.type===`failed`?i??[]:i,l=I(a.name),u=n.clients.findIndex(e=>e.name===a.name)===-1?[...n.clients,a]:n.clients.map(e=>e.name===a.name?a:e),d=o===void 0?n.tools:[...w(n.tools,e=>e.name?.startsWith(l)),...o],f=s===void 0?n.commands:[...w(n.commands,e=>C(e,a.name)),...s],p=c===void 0?n.resources:{...n.resources,...c.length>0?{[a.name]:c}:W(n.resources,a.name)};n={...n,clients:u,tools:d,commands:f,resources:p}}return{...t,mcp:n}}))},[y]),j=(0,q.useCallback)(e=>{E.current.push(e),D.current===null&&(D.current=setTimeout(O,16))},[O]),M=(0,q.useCallback)(({client:e,tools:t,commands:n,resources:r})=>{switch(j({...e,tools:t,commands:n,resources:r}),e.type){case`connected`:T(e.client,e.name,y),e.client.onclose=()=>{let t=e.config.type??`stdio`;if(A(e.name,e.config).catch(()=>{se(`Failed to invalidate the server cache: ${e.name}`)}),m(e.name)){L(e.name,`Server is disabled, skipping automatic reconnection`);return}if(t!==`stdio`&&t!==`sdk`){let n=de(t);L(e.name,`${n} transport closed/disconnected, attempting automatic reconnection`);let r=x.current.get(e.name);r&&(clearTimeout(r),x.current.delete(e.name)),(async()=>{for(let t=1;t<=J;t++){if(m(e.name)){L(e.name,`Server disabled during reconnection, stopping retry`),x.current.delete(e.name);return}j({...e,type:`pending`,reconnectAttempt:t,maxReconnectAttempts:J});let r=Date.now();try{let i=await h(e.name,e.config),a=Date.now()-r;if(i.client.type===`connected`){L(e.name,`${n} reconnection successful after ${a}ms (attempt ${t})`),x.current.delete(e.name),M(i);return}if(L(e.name,`${n} reconnection attempt ${t} completed with status: ${i.client.type}`),t===J){L(e.name,`Max reconnection attempts (${J}) reached, giving up`),x.current.delete(e.name),M(i);return}}catch(i){let a=Date.now()-r;if(R(e.name,`${n} reconnection attempt ${t} failed after ${a}ms: ${i}`),t===J){L(e.name,`Max reconnection attempts (${J}) reached, giving up`),x.current.delete(e.name),j({...e,type:`failed`});return}}let i=Math.min(Y*2**(t-1),X);L(e.name,`Scheduling reconnection attempt ${t+1} in ${i}ms`),await new Promise(t=>{let n=setTimeout(t,i);x.current.set(e.name,n)})}})()}else j({...e,type:`failed`})},e.capabilities?.tools?.listChanged&&e.client.setNotificationHandler(a,async()=>{L(e.name,`Received tools/list_changed notification, refreshing tools`);try{let t=s.cache.get(e.name);s.cache.delete(e.name);let n=await s(e),r=n.length;t?t.then(e=>{V(`tengu_mcp_list_changed`,{type:`tools`,previousCount:e.length,newCount:r})},()=>{V(`tengu_mcp_list_changed`,{type:`tools`,newCount:r})}):V(`tengu_mcp_list_changed`,{type:`tools`,newCount:r}),j({...e,tools:n})}catch(t){R(e.name,`Failed to refresh tools after list_changed notification: ${P(t)}`)}}),e.capabilities?.prompts?.listChanged&&e.client.setNotificationHandler(u,async()=>{L(e.name,`Received prompts/list_changed notification, refreshing prompts`),V(`tengu_mcp_list_changed`,{type:`prompts`});try{k.cache.delete(e.name);let[t,n]=await Promise.all([k(e),Promise.resolve([])]);j({...e,commands:[...t,...n]}),U()}catch(t){R(e.name,`Failed to refresh prompts after list_changed notification: ${P(t)}`)}}),e.capabilities?.resources?.listChanged&&e.client.setNotificationHandler(f,async()=>{L(e.name,`Received resources/list_changed notification, refreshing resources`),V(`tengu_mcp_list_changed`,{type:`resources`});try{_.cache.delete(e.name);{let t=await _(e);j({...e,resources:t})}}catch(t){R(e.name,`Failed to refresh resources after list_changed notification: ${P(t)}`)}});break;case`needs-auth`:case`failed`:case`pending`:case`disabled`:break}},[j]),N=ae();return(0,q.useEffect)(()=>{async function n(){let{servers:n,errors:r}=t?{servers:{},errors:[]}:await i(e),a={...n,...e};K(y,r),y(e=>{let{stale:t,...n}=re(e.mcp,a);for(let e of t){let t=x.current.get(e.name);t&&(clearTimeout(t),x.current.delete(e.name)),e.type===`connected`&&(e.client.onclose=void 0,A(e.name,e.config).catch(()=>{}))}let r=new Set(n.clients.map(e=>e.name)),i=Object.entries(a).filter(([e])=>!r.has(e)).map(([e,t])=>({name:e,type:m(e)?`disabled`:`pending`,config:t}));return i.length===0&&t.length===0?e:{...e,mcp:{...e.mcp,...n,clients:[...n.clients,...i]}}})}n().catch(e=>{R(`useManageMCPConnections`,`Failed to initialize servers as pending: ${P(e)}`)})},[t,e,y,N,l]),(0,q.useEffect)(()=>{let n=!1;async function r(){let r;t||ie()?r=Promise.resolve({}):(p(),r=g());let{servers:a,errors:o}=t?{servers:{},errors:[]}:await i(e,r);if(n)return;K(y,o);let s={...a,...e},l=Object.fromEntries(Object.entries(s).filter(([e])=>!m(e)));v(M,l).catch(e=>{R(`useManageMcpConnections`,`Failed to get MCP resources: ${P(e)}`)});let u={};if(!t){if(u=te(await r).allowed,n)return;if(Object.keys(u).length>0){let{servers:e}=c(u,s);u=e}if(Object.keys(u).length>0){y(e=>{let t=new Set(e.mcp.clients.map(e=>e.name)),n=Object.entries(u).filter(([e])=>!t.has(e)).map(([e,t])=>({name:e,type:m(e)?`disabled`:`pending`,config:t}));return n.length===0?e:{...e,mcp:{...e.mcp,clients:[...e.mcp.clients,...n]}}});let e=Object.fromEntries(Object.entries(u).filter(([e])=>!m(e)));v(M,e).catch(e=>{R(`useManageMcpConnections`,`Failed to get claude.ai MCP resources: ${P(e)}`)})}}let d={...s,...u},f={enterprise:0,global:0,project:0,user:0,plugin:0,claudeai:0};for(let[e,t]of Object.entries(d))t.scope===`enterprise`?f.enterprise++:t.scope===`user`?f.global++:t.scope===`project`?f.project++:t.scope===`local`?f.user++:t.scope===`dynamic`?f.plugin++:t.scope===`claudeai`&&f.claudeai++;V(`tengu_mcp_servers`,{...f})}return r(),()=>{n=!0}},[t,e,M,y,o,N,l]),(0,q.useEffect)(()=>{let e=x.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear(),D.current!==null&&(clearTimeout(D.current),D.current=null,O())}},[O]),{reconnectMcpServer:(0,q.useCallback)(async e=>{let t=r.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);let n=x.current.get(e);n&&(clearTimeout(n),x.current.delete(e));let i=await h(e,t.config);return M(i),i},[r,M]),toggleMcpServer:(0,q.useCallback)(async e=>{let t=r.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);if(t.type!==`disabled`){let n=x.current.get(e);n&&(clearTimeout(n),x.current.delete(e)),d(e,!1),t.type===`connected`&&await A(e,t.config),j({name:e,type:`disabled`,config:t.config})}else{d(e,!0),j({name:e,type:`pending`,config:t.config});let n=await h(e,t.config);M(n)}},[r,j,M])}}function de(e){switch(e){case`http`:return`HTTP`;case`ws`:case`ws-ide`:return`WebSocket`;default:return`SSE`}}var q,J,Y,X,fe=e((()=>{q=t(j(),1),N(),l(),H(),y(),le(),D(),B(),E(),ce(),ne(),x(),oe(),z(),r(),o(),F(),O(),J=5,Y=1e3,X=3e4}));function pe(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpReconnect must be used within MCPConnectionManager`);return e.reconnectMcpServer}function me(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpToggleEnabled must be used within MCPConnectionManager`);return e.toggleMcpServer}function he({children:e,dynamicMcpConfig:t,isStrictMcpConfig:n}){let{reconnectMcpServer:r,toggleMcpServer:i}=ue(t,n),a=(0,Z.useMemo)(()=>({reconnectMcpServer:r,toggleMcpServer:i}),[r,i]);return(0,Q.jsx)($.Provider,{value:a,children:e})}var Z,Q,$,ge=e((()=>{Z=t(j(),1),fe(),Q=M(),$=(0,Z.createContext)(null)}));export{me as i,ge as n,pe as r,he as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$h as i,Dp as a,Dx as o,Eb as s,Kb as c,Mu as l,Op as u,Pu as d,Qu as ee,Rb as te,Ub as f,Wb as ne,Xh as p,Zh as m,Zu as h,cd as re,eS as g,fx as ie,gC as _,hx as ae,jx as v,ld as y,lx as oe,mx as se,ox as ce,tS as le,uC as b,ux as ue,vx as x,yb as de}from"./loadAgentsDir-DXOkUcW3.js";import{D as S,H as fe,I as C,Lt as pe,P as w,T,Wt as me,ai as E,dr as he,hn as ge,j as D,ot as _e,t as O,y as k}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{P as ve,R as j}from"./debug-D58GQBDG.js";import{$ as M,et as N,rt as P}from"./settings-3xZ0fsvE.js";import{c as ye,o as F}from"./log-CZ7ploQm.js";import{n as I,r as L}from"./analytics-DJobLaWP.js";import{l as be,u as R}from"./oauth-D38aRTUb.js";import{l as xe,n as Se,o as z}from"./stringUtils-CKD8qDqx.js";import{Pt as B,Tt as Ce}from"./model-Cxx3suBa.js";import{i as we,n as V,r as Te}from"./MCPConnectionManager-CdpO2Tj9.js";import{n as Ee,t as H}from"./useExitOnCtrlCDWithKeybindings-D0uqGxGw.js";function De({serverToolsCount:e,serverPromptsCount:t,serverResourcesCount:n}){let r=[];return e>0&&r.push(`tools`),n>0&&r.push(`resources`),t>0&&r.push(`prompts`),(0,U.jsxs)(C,{children:[(0,U.jsx)(w,{bold:!0,children:`Capabilities: `}),(0,U.jsx)(w,{color:`text`,children:r.length>0?(0,U.jsx)(T,{children:r}):`none`})]})}var U,Oe=e((()=>{O(),U=A()}));function ke(e,t){switch(e.client.type){case`connected`:return{message:`Reconnected to ${t}.`,success:!0};case`needs-auth`:return{message:`${t} requires authentication. Use the 'Authenticate' option.`,success:!1};case`failed`:return{message:`Failed to reconnect to ${t}.`,success:!1};default:return{message:`Unknown result when reconnecting to ${t}.`,success:!1}}}function Ae(e,t){return`Error reconnecting to ${t}: ${e instanceof Error?e.message:String(e)}`}var W=e((()=>{}));function je({server:e,serverToolsCount:t,onViewTools:n,onCancel:o,onComplete:s,borderless:u=!1}){let[d]=fe(),f=Ee(),{columns:p}=_e(),[h,g]=G.useState(!1),[_,ae]=G.useState(null),v=m(e=>e.mcp),y=i(),[b,x]=G.useState(null),[E,O]=(0,G.useState)(!1),k=(0,G.useRef)(null),[A,j]=(0,G.useState)(!1),[M,N]=(0,G.useState)(null),[P,F]=(0,G.useState)(!1),[I,R]=(0,G.useState)(null),[xe,z]=(0,G.useState)(!1),[B,V]=(0,G.useState)(!1),H=(0,G.useRef)(void 0),U=(0,G.useRef)(!1),[Oe,W]=(0,G.useState)(``),[je,Me]=(0,G.useState)(0),[Ne,q]=(0,G.useState)(null);(0,G.useEffect)(()=>()=>{U.current=!0,k.current?.abort(),H.current!==void 0&&clearTimeout(H.current)},[]);let J=e.isAuthenticated||e.client.type===`connected`&&t>0,Y=Te(),Pe=G.useCallback(async()=>{j(!1),N(null),O(!0);try{let t=await Y(e.name),n=t.client.type===`connected`;L(`tengu_claudeai_mcp_auth_completed`,{success:n}),n?s?.(`Authentication successful. Connected to ${e.name}.`):t.client.type===`needs-auth`?s?.(`Authentication successful, but server still requires authentication. You may need to manually restart Work Mate.`):s?.(`Authentication successful, but server reconnection failed. You may need to manually restart Work Mate for the changes to take effect.`)}catch(t){L(`tengu_claudeai_mcp_auth_completed`,{success:!1}),s?.(Ae(t,e.name))}finally{O(!1)}},[Y,e.name,s]),X=G.useCallback(async()=>{await de(e.name,{...e.config,scope:e.scope}),y(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`needs-auth`}:t),r=ie(t.mcp.tools,e.name),i=oe(t.mcp.commands,e.name),a=ue(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),L(`tengu_claudeai_mcp_clear_auth_completed`,{}),s?.(`Disconnected from ${e.name}.`),F(!1),R(null),z(!1)},[e.name,e.config,e.scope,y,s]);me(`confirm:no`,()=>{k.current?.abort(),k.current=null,g(!1),x(null)},{context:`Confirmation`,isActive:h}),me(`confirm:no`,()=>{j(!1),N(null)},{context:`Confirmation`,isActive:A}),me(`confirm:no`,()=>{F(!1),R(null),z(!1)},{context:`Confirmation`,isActive:P}),ge((e,t)=>{if(t.return&&A&&Pe(),t.return&&P)if(xe)X();else{let e=`${be().CLAUDE_AI_ORIGIN}/settings/connectors`;R(e),z(!0),le(e)}if(e===`c`&&!B){let e=b||M||I;e&&he(e).then(e=>{U.current||(e&&process.stdout.write(e),V(!0),H.current!==void 0&&clearTimeout(H.current),H.current=setTimeout(V,2e3,!1))})}});let Z=Se(String(e.name)),Fe=se(v.commands,e.name).length,Ie=we(),Le=G.useCallback(async()=>{let t=be().CLAUDE_AI_ORIGIN,n=Ce()?.organizationUuid,r;r=n&&e.config.type===`claudeai-proxy`&&e.config.id?`${t}/api/organizations/${n}/mcp/start-auth/${e.config.id.startsWith(`mcprs`)?`mcpsrv${e.config.id.slice(5)}`:e.config.id}?product_surface=${encodeURIComponent(process.env.CLAUDE_CODE_ENTRYPOINT||`cli`)}`:`${t}/settings/connectors`,N(r),j(!0),L(`tengu_claudeai_mcp_auth_started`,{}),await le(r)},[e.config]),Q=G.useCallback(()=>{F(!0),L(`tengu_claudeai_mcp_clear_auth_started`,{})},[]),Re=G.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await Ie(e.name),e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_toggle`,{new_state:t?`disabled`:`enabled`}),o()}catch(n){s?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ve(n)}`)}},[e.client.type,e.config.type,e.name,Ie,o,s]),ze=G.useCallback(async()=>{if(e.config.type===`claudeai-proxy`)return;g(!0),ae(null);let t=new AbortController;k.current=t;try{if(e.isAuthenticated&&e.config&&await c(e.name,e.config,{preserveStepUpState:!0}),e.config){await ne(e.name,e.config,x,t.signal,{onWaitingForCallback:e=>{q(()=>e)}}),L(`tengu_mcp_auth_config_authenticate`,{wasAuthenticated:e.isAuthenticated});let n=await Y(e.name);if(n.client.type===`connected`){let t=J?`Authentication successful. Reconnected to ${e.name}.`:`Authentication successful. Connected to ${e.name}.`;s?.(t)}else n.client.type===`needs-auth`?s?.(`Authentication successful, but server still requires authentication. You may need to manually restart Work Mate.`):(ye(e.name,`Reconnection failed after authentication`),s?.(`Authentication successful, but server reconnection failed. You may need to manually restart Work Mate for the changes to take effect.`))}}catch(e){e instanceof Error&&!(e instanceof te)&&ae(e.message)}finally{g(!1),k.current=null,q(null),W(``)}},[e.isAuthenticated,e.config,e.name,s,Y,J]),Be=async()=>{e.config.type!==`claudeai-proxy`&&e.config&&(await c(e.name,e.config),L(`tengu_mcp_auth_config_clear`,{}),await de(e.name,{...e.config,scope:e.scope}),y(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`failed`}:t),r=ie(t.mcp.tools,e.name),i=oe(t.mcp.commands,e.name),a=ue(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),s?.(`Authentication cleared for ${e.name}.`))};if(h){let t=e.config.type!==`claudeai-proxy`&&e.config.oauth?.xaa?` Authenticating via your identity provider`:` A browser window will open for authentication`;return(0,K.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(l,{}),(0,K.jsx)(w,{children:t})]}),b&&(0,K.jsxs)(C,{flexDirection:`column`,children:[(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),B?(0,K.jsx)(w,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(w,{dimColor:!0,children:(0,K.jsx)(S,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(pe,{url:b})]}),h&&b&&Ne&&(0,K.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,K.jsx)(w,{dimColor:!0,children:`If the redirect page shows a connection error, paste the URL from your browser's address bar:`}),(0,K.jsxs)(C,{children:[(0,K.jsxs)(w,{dimColor:!0,children:[`URL `,`>`,` `]}),(0,K.jsx)(re,{value:Oe,onChange:W,onSubmit:e=>{Ne(e.trim()),W(``)},cursorOffset:je,onChangeCursorOffset:Me,columns:p-8})]})]}),(0,K.jsx)(C,{marginLeft:3,children:(0,K.jsx)(w,{dimColor:!0,children:`Return here after authenticating in your browser. Press Esc to go back.`})})]})}if(A)return(0,K.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(l,{}),(0,K.jsx)(w,{children:` A browser window will open for authentication`})]}),M&&(0,K.jsxs)(C,{flexDirection:`column`,children:[(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),B?(0,K.jsx)(w,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(w,{dimColor:!0,children:(0,K.jsx)(S,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(pe,{url:M})]}),(0,K.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(w,{color:`permission`,children:[`Press `,(0,K.jsx)(w,{bold:!0,children:`Enter`}),` after authenticating in your browser.`]}),(0,K.jsx)(w,{dimColor:!0,italic:!0,children:(0,K.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]});if(P)return(0,K.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Clear authentication for `,e.name]}),xe?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w,{children:`Find the MCP server in the browser and click "Disconnect".`}),I&&(0,K.jsxs)(C,{flexDirection:`column`,children:[(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{dimColor:!0,children:`If your browser didn't open automatically, copy this URL manually `}),B?(0,K.jsx)(w,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(w,{dimColor:!0,children:(0,K.jsx)(S,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(pe,{url:I})]}),(0,K.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(w,{color:`permission`,children:[`Press `,(0,K.jsx)(w,{bold:!0,children:`Enter`}),` when done.`]}),(0,K.jsx)(w,{dimColor:!0,italic:!0,children:(0,K.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w,{children:`This will open claude.ai in the browser. Find the MCP server in the list and click "Disconnect".`}),(0,K.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(w,{color:`permission`,children:[`Press `,(0,K.jsx)(w,{bold:!0,children:`Enter`}),` to open the browser.`]}),(0,K.jsx)(w,{dimColor:!0,italic:!0,children:(0,K.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]})]});if(E)return(0,K.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`text`,children:[`Connecting to `,(0,K.jsx)(w,{bold:!0,children:e.name}),`…`]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(l,{}),(0,K.jsx)(w,{children:` Establishing connection to MCP server`})]}),(0,K.jsx)(w,{dimColor:!0,children:`This may take a few moments.`})]});let $=[];return e.client.type===`disabled`&&$.push({label:`Enable`,value:`toggle-enabled`}),e.client.type===`connected`&&t>0&&$.push({label:`View tools`,value:`tools`}),e.config.type===`claudeai-proxy`?e.client.type===`connected`?$.push({label:`Clear authentication`,value:`claudeai-clear-auth`}):e.client.type!==`disabled`&&$.push({label:`Authenticate`,value:`claudeai-auth`}):(J&&($.push({label:`Re-authenticate`,value:`reauth`}),$.push({label:`Clear authentication`,value:`clear-auth`})),J||$.push({label:`Authenticate`,value:`auth`})),e.client.type!==`disabled`&&(e.client.type!==`needs-auth`&&$.push({label:`Reconnect`,value:`reconnectMcpServer`}),$.push({label:`Disable`,value:`toggle-enabled`})),$.length===0&&$.push({label:`Back`,value:`back`}),(0,K.jsxs)(C,{flexDirection:`column`,children:[(0,K.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:u?void 0:`round`,children:[(0,K.jsx)(C,{marginBottom:1,children:(0,K.jsxs)(w,{bold:!0,children:[Z,` MCP Server`]})}),(0,K.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,K.jsxs)(w,{children:[D(`inactive`,d)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,K.jsxs)(w,{children:[D(`success`,d)(r.tick),` connected`]}):e.client.type===`pending`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w,{dimColor:!0,children:r.radioOff}),(0,K.jsx)(w,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,K.jsxs)(w,{children:[D(`warning`,d)(r.triangleUpOutline),` needs authentication`]}):(0,K.jsxs)(w,{children:[D(`error`,d)(r.cross),` failed`]})]}),e.transport!==`claudeai-proxy`&&(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`Auth: `}),J?(0,K.jsxs)(w,{children:[D(`success`,d)(r.tick),` authenticated`]}):(0,K.jsxs)(w,{children:[D(`error`,d)(r.cross),` not authenticated`]})]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`URL: `}),(0,K.jsx)(w,{dimColor:!0,children:e.config.url})]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`Config location: `}),(0,K.jsx)(w,{dimColor:!0,children:ce(e.scope)})]}),e.client.type===`connected`&&(0,K.jsx)(De,{serverToolsCount:t,serverPromptsCount:Fe,serverResourcesCount:v.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`Tools: `}),(0,K.jsxs)(w,{dimColor:!0,children:[t,` tools`]})]})]}),_&&(0,K.jsx)(C,{marginTop:1,children:(0,K.jsxs)(w,{color:`error`,children:[`Error: `,_]})}),$.length>0&&(0,K.jsx)(C,{marginTop:1,children:(0,K.jsx)(ee,{options:$,onChange:async t=>{switch(t){case`tools`:n();break;case`auth`:case`reauth`:await ze();break;case`clear-auth`:await Be();break;case`claudeai-auth`:await Le();break;case`claudeai-clear-auth`:Q();break;case`reconnectMcpServer`:O(!0);try{let t=await Y(e.name);e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_reconnect`,{success:t.client.type===`connected`});let{message:n}=ke(t,e.name);s?.(n)}catch(t){e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_reconnect`,{success:!1}),s?.(Ae(t,e.name))}finally{O(!1)}break;case`toggle-enabled`:await Re();break;case`back`:o();break}},onCancel:o})})]}),(0,K.jsx)(C,{marginTop:1,children:(0,K.jsx)(w,{dimColor:!0,italic:!0,children:f.pending?(0,K.jsxs)(K.Fragment,{children:[`Press `,f.keyName,` again to exit`]}):(0,K.jsxs)(T,{children:[(0,K.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,K.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,K.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var G,K,Me=e((()=>{n(),G=t(E(),1),I(),R(),H(),_(),O(),b(),f(),s(),V(),x(),p(),B(),g(),j(),F(),z(),u(),h(),d(),y(),Oe(),W(),K=A()}));function Ne({server:e,serverToolsCount:t,onViewTools:n,onCancel:i,onComplete:s,borderless:c=!1}){let[u]=fe(),d=Ee(),te=m(e=>e.mcp),f=Te(),ne=we(),[p,h]=(0,q.useState)(!1),re=q.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await ne(e.name),i()}catch(n){s(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ve(n)}`)}},[e.client.type,e.name,ne,i,s]),g=Se(String(e.name)),ie=se(te.commands,e.name).length,_=[];return e.client.type!==`disabled`&&t>0&&_.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&_.push({label:`Reconnect`,value:`reconnectMcpServer`}),_.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),_.length===0&&_.push({label:`Back`,value:`back`}),p?(0,J.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(w,{color:`text`,children:[`Reconnecting to `,(0,J.jsx)(w,{bold:!0,children:e.name})]}),(0,J.jsxs)(C,{children:[(0,J.jsx)(l,{}),(0,J.jsx)(w,{children:` Restarting MCP server process`})]}),(0,J.jsx)(w,{dimColor:!0,children:`This may take a few moments.`})]}):(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:c?void 0:`round`,children:[(0,J.jsx)(C,{marginBottom:1,children:(0,J.jsxs)(w,{bold:!0,children:[g,` MCP Server`]})}),(0,J.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,J.jsxs)(w,{children:[D(`inactive`,u)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,J.jsxs)(w,{children:[D(`success`,u)(r.tick),` connected`]}):e.client.type===`pending`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(w,{dimColor:!0,children:r.radioOff}),(0,J.jsx)(w,{children:` connecting…`})]}):(0,J.jsxs)(w,{children:[D(`error`,u)(r.cross),` failed`]})]}),(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Command: `}),(0,J.jsx)(w,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Args: `}),(0,J.jsx)(w,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Config location: `}),(0,J.jsx)(w,{dimColor:!0,children:ce(o(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,J.jsx)(De,{serverToolsCount:t,serverPromptsCount:ie,serverResourcesCount:te.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Tools: `}),(0,J.jsxs)(w,{dimColor:!0,children:[t,` tools`]})]})]}),_.length>0&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(ee,{options:_,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){h(!0);try{let{message:t}=ke(await f(e.name),e.name);s?.(t)}catch(t){s?.(Ae(t,e.name))}finally{h(!1)}}else t===`toggle-enabled`?await re():t===`back`&&i()},onCancel:i})})]}),(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(w,{dimColor:!0,italic:!0,children:d.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,d.keyName,` again to exit`]}):(0,J.jsxs)(T,{children:[(0,J.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var q,J,Y=e((()=>{n(),q=t(E(),1),H(),O(),v(),V(),x(),p(),j(),z(),u(),h(),d(),Oe(),W(),J=A()}));function Pe({tool:e,server:t,onBack:n}){let[r,i]=X.useState(``),o=N(e.name,t.name),s=M(e.userFacingName?e.userFacingName({}):o),c=e.isReadOnly?.({})??!1,l=e.isDestructive?.({})??!1,u=e.isOpenWorld?.({})??!1;return X.useEffect(()=>{async function t(){try{let t=await e.description({},{isNonInteractiveSession:!1,toolPermissionContext:{mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!1},tools:[]});i(t)}catch{i(`Failed to load description`)}}t()},[e]),(0,Z.jsx)(k,{title:(0,Z.jsxs)(Z.Fragment,{children:[s,c&&(0,Z.jsx)(w,{color:`success`,children:` [read-only]`}),l&&(0,Z.jsx)(w,{color:`error`,children:` [destructive]`}),u&&(0,Z.jsx)(w,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,Z.jsxs)(w,{children:[`Press `,e.keyName,` again to exit`]}):(0,Z.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsxs)(C,{children:[(0,Z.jsx)(w,{bold:!0,children:`Tool name: `}),(0,Z.jsx)(w,{dimColor:!0,children:o})]}),(0,Z.jsxs)(C,{children:[(0,Z.jsx)(w,{bold:!0,children:`Full name: `}),(0,Z.jsx)(w,{dimColor:!0,children:e.name})]}),r&&(0,Z.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,Z.jsx)(w,{bold:!0,children:`Description:`}),(0,Z.jsx)(w,{wrap:`wrap`,children:r})]}),e.inputJSONSchema?.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,Z.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,Z.jsx)(w,{bold:!0,children:`Parameters:`}),(0,Z.jsx)(C,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,Z.jsxs)(w,{children:[`• `,t,r&&(0,Z.jsx)(w,{dimColor:!0,children:` (required)`}),`:`,` `,(0,Z.jsx)(w,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,Z.jsxs)(w,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var X,Z,Fe=e((()=>{X=t(E(),1),O(),P(),u(),Z=A()}));function Ie({server:e,onSelectTool:t,onBack:n}){let r=m(e=>e.mcp.tools),i=Le.useMemo(()=>e.client.type===`connected`?ae(r,e.name):[],[e,r]),o=i.map((t,n)=>{let r=N(t.name,e.name),i=M(t.userFacingName?t.userFacingName({}):r),a=t.isReadOnly?.({})??!1,o=t.isDestructive?.({})??!1,s=t.isOpenWorld?.({})??!1,c=[];return a&&c.push(`read-only`),o&&c.push(`destructive`),s&&c.push(`open-world`),{label:i,value:n.toString(),description:c.length>0?c.join(`, `):void 0,descriptionColor:o?`error`:a?`success`:void 0}});return(0,Q.jsx)(k,{title:`Tools for ${e.name}`,subtitle:`${i.length} ${xe(i.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,Q.jsxs)(w,{children:[`Press `,e.keyName,` again to exit`]}):(0,Q.jsxs)(T,{children:[(0,Q.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,Q.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,Q.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:i.length===0?(0,Q.jsx)(w,{dimColor:!0,children:`No tools available`}):(0,Q.jsx)(ee,{options:o,onChange:e=>{let n=parseInt(e,10),r=i[n];r&&t(r,n)},onCancel:n})})}var Le,Q,Re=e((()=>{Le=t(E(),1),O(),P(),x(),p(),z(),u(),h(),Q=A()}));export{Ne as a,Me as c,Fe as i,Re as n,Y as o,Pe as r,je as s,Ie as t};
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$h as i,Dp as a,Dx as o,Eb as s,Kb as c,Mu as l,Op as u,Pu as d,Qu as ee,Rb as te,Ub as f,Wb as ne,Xh as p,Zh as m,Zu as h,cd as re,eS as g,fx as ie,gC as _,hx as ae,jx as v,ld as y,lx as oe,mx as se,ox as ce,tS as le,uC as b,ux as ue,vx as x,yb as de}from"./loadAgentsDir-DaNpxaO-.js";import{D as S,H as fe,I as C,Lt as pe,P as w,T,Wt as me,ai as E,dr as he,hn as ge,j as D,ot as _e,t as O,y as k}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{P as ve,R as j}from"./debug-D58GQBDG.js";import{$ as M,et as N,rt as P}from"./settings-3xZ0fsvE.js";import{c as ye,o as F}from"./log-CZ7ploQm.js";import{n as I,r as L}from"./analytics-DJobLaWP.js";import{l as be,u as R}from"./oauth-D38aRTUb.js";import{l as xe,n as Se,o as z}from"./stringUtils-CKD8qDqx.js";import{Pt as B,Tt as Ce}from"./model-Do0f476p.js";import{i as we,n as V,r as Te}from"./MCPConnectionManager-DfyoZaiu.js";import{n as Ee,t as H}from"./useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js";function De({serverToolsCount:e,serverPromptsCount:t,serverResourcesCount:n}){let r=[];return e>0&&r.push(`tools`),n>0&&r.push(`resources`),t>0&&r.push(`prompts`),(0,U.jsxs)(C,{children:[(0,U.jsx)(w,{bold:!0,children:`Capabilities: `}),(0,U.jsx)(w,{color:`text`,children:r.length>0?(0,U.jsx)(T,{children:r}):`none`})]})}var U,Oe=e((()=>{O(),U=A()}));function ke(e,t){switch(e.client.type){case`connected`:return{message:`Reconnected to ${t}.`,success:!0};case`needs-auth`:return{message:`${t} requires authentication. Use the 'Authenticate' option.`,success:!1};case`failed`:return{message:`Failed to reconnect to ${t}.`,success:!1};default:return{message:`Unknown result when reconnecting to ${t}.`,success:!1}}}function Ae(e,t){return`Error reconnecting to ${t}: ${e instanceof Error?e.message:String(e)}`}var W=e((()=>{}));function je({server:e,serverToolsCount:t,onViewTools:n,onCancel:o,onComplete:s,borderless:u=!1}){let[d]=fe(),f=Ee(),{columns:p}=_e(),[h,g]=G.useState(!1),[_,ae]=G.useState(null),v=m(e=>e.mcp),y=i(),[b,x]=G.useState(null),[E,O]=(0,G.useState)(!1),k=(0,G.useRef)(null),[A,j]=(0,G.useState)(!1),[M,N]=(0,G.useState)(null),[P,F]=(0,G.useState)(!1),[I,R]=(0,G.useState)(null),[xe,z]=(0,G.useState)(!1),[B,V]=(0,G.useState)(!1),H=(0,G.useRef)(void 0),U=(0,G.useRef)(!1),[Oe,W]=(0,G.useState)(``),[je,Me]=(0,G.useState)(0),[Ne,q]=(0,G.useState)(null);(0,G.useEffect)(()=>()=>{U.current=!0,k.current?.abort(),H.current!==void 0&&clearTimeout(H.current)},[]);let J=e.isAuthenticated||e.client.type===`connected`&&t>0,Y=Te(),Pe=G.useCallback(async()=>{j(!1),N(null),O(!0);try{let t=await Y(e.name),n=t.client.type===`connected`;L(`tengu_claudeai_mcp_auth_completed`,{success:n}),n?s?.(`Authentication successful. Connected to ${e.name}.`):t.client.type===`needs-auth`?s?.(`Authentication successful, but server still requires authentication. You may need to manually restart Work Mate.`):s?.(`Authentication successful, but server reconnection failed. You may need to manually restart Work Mate for the changes to take effect.`)}catch(t){L(`tengu_claudeai_mcp_auth_completed`,{success:!1}),s?.(Ae(t,e.name))}finally{O(!1)}},[Y,e.name,s]),X=G.useCallback(async()=>{await de(e.name,{...e.config,scope:e.scope}),y(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`needs-auth`}:t),r=ie(t.mcp.tools,e.name),i=oe(t.mcp.commands,e.name),a=ue(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),L(`tengu_claudeai_mcp_clear_auth_completed`,{}),s?.(`Disconnected from ${e.name}.`),F(!1),R(null),z(!1)},[e.name,e.config,e.scope,y,s]);me(`confirm:no`,()=>{k.current?.abort(),k.current=null,g(!1),x(null)},{context:`Confirmation`,isActive:h}),me(`confirm:no`,()=>{j(!1),N(null)},{context:`Confirmation`,isActive:A}),me(`confirm:no`,()=>{F(!1),R(null),z(!1)},{context:`Confirmation`,isActive:P}),ge((e,t)=>{if(t.return&&A&&Pe(),t.return&&P)if(xe)X();else{let e=`${be().CLAUDE_AI_ORIGIN}/settings/connectors`;R(e),z(!0),le(e)}if(e===`c`&&!B){let e=b||M||I;e&&he(e).then(e=>{U.current||(e&&process.stdout.write(e),V(!0),H.current!==void 0&&clearTimeout(H.current),H.current=setTimeout(V,2e3,!1))})}});let Z=Se(String(e.name)),Fe=se(v.commands,e.name).length,Ie=we(),Le=G.useCallback(async()=>{let t=be().CLAUDE_AI_ORIGIN,n=Ce()?.organizationUuid,r;r=n&&e.config.type===`claudeai-proxy`&&e.config.id?`${t}/api/organizations/${n}/mcp/start-auth/${e.config.id.startsWith(`mcprs`)?`mcpsrv${e.config.id.slice(5)}`:e.config.id}?product_surface=${encodeURIComponent(process.env.CLAUDE_CODE_ENTRYPOINT||`cli`)}`:`${t}/settings/connectors`,N(r),j(!0),L(`tengu_claudeai_mcp_auth_started`,{}),await le(r)},[e.config]),Q=G.useCallback(()=>{F(!0),L(`tengu_claudeai_mcp_clear_auth_started`,{})},[]),Re=G.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await Ie(e.name),e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_toggle`,{new_state:t?`disabled`:`enabled`}),o()}catch(n){s?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ve(n)}`)}},[e.client.type,e.config.type,e.name,Ie,o,s]),ze=G.useCallback(async()=>{if(e.config.type===`claudeai-proxy`)return;g(!0),ae(null);let t=new AbortController;k.current=t;try{if(e.isAuthenticated&&e.config&&await c(e.name,e.config,{preserveStepUpState:!0}),e.config){await ne(e.name,e.config,x,t.signal,{onWaitingForCallback:e=>{q(()=>e)}}),L(`tengu_mcp_auth_config_authenticate`,{wasAuthenticated:e.isAuthenticated});let n=await Y(e.name);if(n.client.type===`connected`){let t=J?`Authentication successful. Reconnected to ${e.name}.`:`Authentication successful. Connected to ${e.name}.`;s?.(t)}else n.client.type===`needs-auth`?s?.(`Authentication successful, but server still requires authentication. You may need to manually restart Work Mate.`):(ye(e.name,`Reconnection failed after authentication`),s?.(`Authentication successful, but server reconnection failed. You may need to manually restart Work Mate for the changes to take effect.`))}}catch(e){e instanceof Error&&!(e instanceof te)&&ae(e.message)}finally{g(!1),k.current=null,q(null),W(``)}},[e.isAuthenticated,e.config,e.name,s,Y,J]),Be=async()=>{e.config.type!==`claudeai-proxy`&&e.config&&(await c(e.name,e.config),L(`tengu_mcp_auth_config_clear`,{}),await de(e.name,{...e.config,scope:e.scope}),y(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`failed`}:t),r=ie(t.mcp.tools,e.name),i=oe(t.mcp.commands,e.name),a=ue(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),s?.(`Authentication cleared for ${e.name}.`))};if(h){let t=e.config.type!==`claudeai-proxy`&&e.config.oauth?.xaa?` Authenticating via your identity provider`:` A browser window will open for authentication`;return(0,K.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(l,{}),(0,K.jsx)(w,{children:t})]}),b&&(0,K.jsxs)(C,{flexDirection:`column`,children:[(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),B?(0,K.jsx)(w,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(w,{dimColor:!0,children:(0,K.jsx)(S,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(pe,{url:b})]}),h&&b&&Ne&&(0,K.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,K.jsx)(w,{dimColor:!0,children:`If the redirect page shows a connection error, paste the URL from your browser's address bar:`}),(0,K.jsxs)(C,{children:[(0,K.jsxs)(w,{dimColor:!0,children:[`URL `,`>`,` `]}),(0,K.jsx)(re,{value:Oe,onChange:W,onSubmit:e=>{Ne(e.trim()),W(``)},cursorOffset:je,onChangeCursorOffset:Me,columns:p-8})]})]}),(0,K.jsx)(C,{marginLeft:3,children:(0,K.jsx)(w,{dimColor:!0,children:`Return here after authenticating in your browser. Press Esc to go back.`})})]})}if(A)return(0,K.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(l,{}),(0,K.jsx)(w,{children:` A browser window will open for authentication`})]}),M&&(0,K.jsxs)(C,{flexDirection:`column`,children:[(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),B?(0,K.jsx)(w,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(w,{dimColor:!0,children:(0,K.jsx)(S,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(pe,{url:M})]}),(0,K.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(w,{color:`permission`,children:[`Press `,(0,K.jsx)(w,{bold:!0,children:`Enter`}),` after authenticating in your browser.`]}),(0,K.jsx)(w,{dimColor:!0,italic:!0,children:(0,K.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]});if(P)return(0,K.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Clear authentication for `,e.name]}),xe?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w,{children:`Find the MCP server in the browser and click "Disconnect".`}),I&&(0,K.jsxs)(C,{flexDirection:`column`,children:[(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{dimColor:!0,children:`If your browser didn't open automatically, copy this URL manually `}),B?(0,K.jsx)(w,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(w,{dimColor:!0,children:(0,K.jsx)(S,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(pe,{url:I})]}),(0,K.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(w,{color:`permission`,children:[`Press `,(0,K.jsx)(w,{bold:!0,children:`Enter`}),` when done.`]}),(0,K.jsx)(w,{dimColor:!0,italic:!0,children:(0,K.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w,{children:`This will open claude.ai in the browser. Find the MCP server in the list and click "Disconnect".`}),(0,K.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(w,{color:`permission`,children:[`Press `,(0,K.jsx)(w,{bold:!0,children:`Enter`}),` to open the browser.`]}),(0,K.jsx)(w,{dimColor:!0,italic:!0,children:(0,K.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]})]});if(E)return(0,K.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`text`,children:[`Connecting to `,(0,K.jsx)(w,{bold:!0,children:e.name}),`…`]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(l,{}),(0,K.jsx)(w,{children:` Establishing connection to MCP server`})]}),(0,K.jsx)(w,{dimColor:!0,children:`This may take a few moments.`})]});let $=[];return e.client.type===`disabled`&&$.push({label:`Enable`,value:`toggle-enabled`}),e.client.type===`connected`&&t>0&&$.push({label:`View tools`,value:`tools`}),e.config.type===`claudeai-proxy`?e.client.type===`connected`?$.push({label:`Clear authentication`,value:`claudeai-clear-auth`}):e.client.type!==`disabled`&&$.push({label:`Authenticate`,value:`claudeai-auth`}):(J&&($.push({label:`Re-authenticate`,value:`reauth`}),$.push({label:`Clear authentication`,value:`clear-auth`})),J||$.push({label:`Authenticate`,value:`auth`})),e.client.type!==`disabled`&&(e.client.type!==`needs-auth`&&$.push({label:`Reconnect`,value:`reconnectMcpServer`}),$.push({label:`Disable`,value:`toggle-enabled`})),$.length===0&&$.push({label:`Back`,value:`back`}),(0,K.jsxs)(C,{flexDirection:`column`,children:[(0,K.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:u?void 0:`round`,children:[(0,K.jsx)(C,{marginBottom:1,children:(0,K.jsxs)(w,{bold:!0,children:[Z,` MCP Server`]})}),(0,K.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,K.jsxs)(w,{children:[D(`inactive`,d)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,K.jsxs)(w,{children:[D(`success`,d)(r.tick),` connected`]}):e.client.type===`pending`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w,{dimColor:!0,children:r.radioOff}),(0,K.jsx)(w,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,K.jsxs)(w,{children:[D(`warning`,d)(r.triangleUpOutline),` needs authentication`]}):(0,K.jsxs)(w,{children:[D(`error`,d)(r.cross),` failed`]})]}),e.transport!==`claudeai-proxy`&&(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`Auth: `}),J?(0,K.jsxs)(w,{children:[D(`success`,d)(r.tick),` authenticated`]}):(0,K.jsxs)(w,{children:[D(`error`,d)(r.cross),` not authenticated`]})]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`URL: `}),(0,K.jsx)(w,{dimColor:!0,children:e.config.url})]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`Config location: `}),(0,K.jsx)(w,{dimColor:!0,children:ce(e.scope)})]}),e.client.type===`connected`&&(0,K.jsx)(De,{serverToolsCount:t,serverPromptsCount:Fe,serverResourcesCount:v.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`Tools: `}),(0,K.jsxs)(w,{dimColor:!0,children:[t,` tools`]})]})]}),_&&(0,K.jsx)(C,{marginTop:1,children:(0,K.jsxs)(w,{color:`error`,children:[`Error: `,_]})}),$.length>0&&(0,K.jsx)(C,{marginTop:1,children:(0,K.jsx)(ee,{options:$,onChange:async t=>{switch(t){case`tools`:n();break;case`auth`:case`reauth`:await ze();break;case`clear-auth`:await Be();break;case`claudeai-auth`:await Le();break;case`claudeai-clear-auth`:Q();break;case`reconnectMcpServer`:O(!0);try{let t=await Y(e.name);e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_reconnect`,{success:t.client.type===`connected`});let{message:n}=ke(t,e.name);s?.(n)}catch(t){e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_reconnect`,{success:!1}),s?.(Ae(t,e.name))}finally{O(!1)}break;case`toggle-enabled`:await Re();break;case`back`:o();break}},onCancel:o})})]}),(0,K.jsx)(C,{marginTop:1,children:(0,K.jsx)(w,{dimColor:!0,italic:!0,children:f.pending?(0,K.jsxs)(K.Fragment,{children:[`Press `,f.keyName,` again to exit`]}):(0,K.jsxs)(T,{children:[(0,K.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,K.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,K.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var G,K,Me=e((()=>{n(),G=t(E(),1),I(),R(),H(),_(),O(),b(),f(),s(),V(),x(),p(),B(),g(),j(),F(),z(),u(),h(),d(),y(),Oe(),W(),K=A()}));function Ne({server:e,serverToolsCount:t,onViewTools:n,onCancel:i,onComplete:s,borderless:c=!1}){let[u]=fe(),d=Ee(),te=m(e=>e.mcp),f=Te(),ne=we(),[p,h]=(0,q.useState)(!1),re=q.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await ne(e.name),i()}catch(n){s(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ve(n)}`)}},[e.client.type,e.name,ne,i,s]),g=Se(String(e.name)),ie=se(te.commands,e.name).length,_=[];return e.client.type!==`disabled`&&t>0&&_.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&_.push({label:`Reconnect`,value:`reconnectMcpServer`}),_.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),_.length===0&&_.push({label:`Back`,value:`back`}),p?(0,J.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(w,{color:`text`,children:[`Reconnecting to `,(0,J.jsx)(w,{bold:!0,children:e.name})]}),(0,J.jsxs)(C,{children:[(0,J.jsx)(l,{}),(0,J.jsx)(w,{children:` Restarting MCP server process`})]}),(0,J.jsx)(w,{dimColor:!0,children:`This may take a few moments.`})]}):(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:c?void 0:`round`,children:[(0,J.jsx)(C,{marginBottom:1,children:(0,J.jsxs)(w,{bold:!0,children:[g,` MCP Server`]})}),(0,J.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,J.jsxs)(w,{children:[D(`inactive`,u)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,J.jsxs)(w,{children:[D(`success`,u)(r.tick),` connected`]}):e.client.type===`pending`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(w,{dimColor:!0,children:r.radioOff}),(0,J.jsx)(w,{children:` connecting…`})]}):(0,J.jsxs)(w,{children:[D(`error`,u)(r.cross),` failed`]})]}),(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Command: `}),(0,J.jsx)(w,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Args: `}),(0,J.jsx)(w,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Config location: `}),(0,J.jsx)(w,{dimColor:!0,children:ce(o(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,J.jsx)(De,{serverToolsCount:t,serverPromptsCount:ie,serverResourcesCount:te.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Tools: `}),(0,J.jsxs)(w,{dimColor:!0,children:[t,` tools`]})]})]}),_.length>0&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(ee,{options:_,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){h(!0);try{let{message:t}=ke(await f(e.name),e.name);s?.(t)}catch(t){s?.(Ae(t,e.name))}finally{h(!1)}}else t===`toggle-enabled`?await re():t===`back`&&i()},onCancel:i})})]}),(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(w,{dimColor:!0,italic:!0,children:d.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,d.keyName,` again to exit`]}):(0,J.jsxs)(T,{children:[(0,J.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var q,J,Y=e((()=>{n(),q=t(E(),1),H(),O(),v(),V(),x(),p(),j(),z(),u(),h(),d(),Oe(),W(),J=A()}));function Pe({tool:e,server:t,onBack:n}){let[r,i]=X.useState(``),o=N(e.name,t.name),s=M(e.userFacingName?e.userFacingName({}):o),c=e.isReadOnly?.({})??!1,l=e.isDestructive?.({})??!1,u=e.isOpenWorld?.({})??!1;return X.useEffect(()=>{async function t(){try{let t=await e.description({},{isNonInteractiveSession:!1,toolPermissionContext:{mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!1},tools:[]});i(t)}catch{i(`Failed to load description`)}}t()},[e]),(0,Z.jsx)(k,{title:(0,Z.jsxs)(Z.Fragment,{children:[s,c&&(0,Z.jsx)(w,{color:`success`,children:` [read-only]`}),l&&(0,Z.jsx)(w,{color:`error`,children:` [destructive]`}),u&&(0,Z.jsx)(w,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,Z.jsxs)(w,{children:[`Press `,e.keyName,` again to exit`]}):(0,Z.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsxs)(C,{children:[(0,Z.jsx)(w,{bold:!0,children:`Tool name: `}),(0,Z.jsx)(w,{dimColor:!0,children:o})]}),(0,Z.jsxs)(C,{children:[(0,Z.jsx)(w,{bold:!0,children:`Full name: `}),(0,Z.jsx)(w,{dimColor:!0,children:e.name})]}),r&&(0,Z.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,Z.jsx)(w,{bold:!0,children:`Description:`}),(0,Z.jsx)(w,{wrap:`wrap`,children:r})]}),e.inputJSONSchema?.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,Z.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,Z.jsx)(w,{bold:!0,children:`Parameters:`}),(0,Z.jsx)(C,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,Z.jsxs)(w,{children:[`• `,t,r&&(0,Z.jsx)(w,{dimColor:!0,children:` (required)`}),`:`,` `,(0,Z.jsx)(w,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,Z.jsxs)(w,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var X,Z,Fe=e((()=>{X=t(E(),1),O(),P(),u(),Z=A()}));function Ie({server:e,onSelectTool:t,onBack:n}){let r=m(e=>e.mcp.tools),i=Le.useMemo(()=>e.client.type===`connected`?ae(r,e.name):[],[e,r]),o=i.map((t,n)=>{let r=N(t.name,e.name),i=M(t.userFacingName?t.userFacingName({}):r),a=t.isReadOnly?.({})??!1,o=t.isDestructive?.({})??!1,s=t.isOpenWorld?.({})??!1,c=[];return a&&c.push(`read-only`),o&&c.push(`destructive`),s&&c.push(`open-world`),{label:i,value:n.toString(),description:c.length>0?c.join(`, `):void 0,descriptionColor:o?`error`:a?`success`:void 0}});return(0,Q.jsx)(k,{title:`Tools for ${e.name}`,subtitle:`${i.length} ${xe(i.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,Q.jsxs)(w,{children:[`Press `,e.keyName,` again to exit`]}):(0,Q.jsxs)(T,{children:[(0,Q.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,Q.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,Q.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:i.length===0?(0,Q.jsx)(w,{dimColor:!0,children:`No tools available`}):(0,Q.jsx)(ee,{options:o,onChange:e=>{let n=parseInt(e,10),r=i[n];r&&t(r,n)},onCancel:n})})}var Le,Q,Re=e((()=>{Le=t(E(),1),O(),P(),x(),p(),z(),u(),h(),Q=A()}));export{Ne as a,Me as c,Fe as i,Re as n,Y as o,Pe as r,je as s,Ie as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Ox as n,_x as r,jx as i,ox as a,vx as o}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Ox as n,_x as r,jx as i,ox as a,vx as o}from"./loadAgentsDir-DaNpxaO-.js";import{I as s,Lt as c,P as l,ai as u,t as d}from"./src-DL3w8VPk2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";function p({scope:e,parsingErrors:t,warnings:n}){let i=t.length>0,o=n.length>0;return!i&&!o?null:(0,_.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,_.jsxs)(s,{children:[(i||o)&&(0,_.jsxs)(l,{color:i?`error`:`warning`,children:[`[`,i?`Failed to parse`:`Contains warnings`,`] `]}),(0,_.jsx)(l,{children:r(e)})]}),(0,_.jsxs)(s,{children:[(0,_.jsx)(l,{dimColor:!0,children:`Location: `}),(0,_.jsx)(l,{dimColor:!0,children:a(e)})]}),(0,_.jsxs)(s,{marginLeft:1,flexDirection:`column`,children:[t.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(s,{children:(0,_.jsxs)(l,{children:[(0,_.jsx)(l,{dimColor:!0,children:`└ `}),(0,_.jsx)(l,{color:`error`,children:`[Error]`}),(0,_.jsxs)(l,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`error-${t}`)}),n.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(s,{children:(0,_.jsxs)(l,{children:[(0,_.jsx)(l,{dimColor:!0,children:`└ `}),(0,_.jsx)(l,{color:`warning`,children:`[Warning]`}),(0,_.jsxs)(l,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`warning-${t}`)})]})]})}function m(){let e=(0,g.useMemo)(()=>[{scope:`user`,config:n(`user`)},{scope:`project`,config:n(`project`)},{scope:`local`,config:n(`local`)},{scope:`enterprise`,config:n(`enterprise`)}],[]),t=e.some(({config:e})=>h(e.errors,`fatal`).length>0),r=e.some(({config:e})=>h(e.errors,`warning`).length>0);return!t&&!r?null:(0,_.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,_.jsx)(l,{bold:!0,children:`MCP Config Diagnostics`}),(0,_.jsx)(s,{marginTop:1,children:(0,_.jsxs)(l,{dimColor:!0,children:[`For help configuring MCP servers, see:`,` `,(0,_.jsx)(c,{url:`https://code.workmate.com/docs/en/mcp`,children:`https://code.workmate.com/docs/en/mcp`})]})}),e.map(({scope:e,config:t})=>(0,_.jsx)(p,{scope:e,parsingErrors:h(t.errors,`fatal`),warnings:h(t.errors,`warning`)},e))]})}function h(e,t){return e.filter(e=>e.mcpErrorMetadata?.severity===t)}var g,_,v=e((()=>{g=t(u(),1),i(),o(),d(),_=f()}));export{v as n,m as t};
|