From b24c7a572f0d5f5a77f15d0646b638b8b1f5fbd8 Mon Sep 17 00:00:00 2001 From: Shantur Rathore Date: Fri, 24 Oct 2025 12:35:53 +0100 Subject: [PATCH] Remove agent cycling and enhance model selector display - Remove Tab/Shift+Tab shortcuts for cycling agents - Remove Next/Previous Agent commands from command palette - Remove handleCycleAgent and handleCycleAgentReverse functions - Remove Tab keyboard hint from agent selector UI - Enhance model selector to show provider/modelId below model name - Widen model selector button to accommodate additional text --- src/App.tsx | 70 ------------------------------- src/components/agent-selector.tsx | 13 ++---- src/components/model-selector.tsx | 13 ++++-- src/lib/shortcuts/agent.ts | 33 +-------------- 4 files changed, 14 insertions(+), 115 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 12d5bdca..82311e4e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -371,26 +371,6 @@ const App: Component = () => { }, }) - commandRegistry.register({ - id: "next-agent", - label: "Next Agent", - description: "Cycle to next agent", - category: "Agent & Model", - keywords: ["agent", "switch", "cycle"], - shortcut: { key: "Tab" }, - action: handleCycleAgent, - }) - - commandRegistry.register({ - id: "prev-agent", - label: "Previous Agent", - description: "Cycle to previous agent", - category: "Agent & Model", - keywords: ["agent", "switch", "cycle"], - shortcut: { key: "Tab", shift: true }, - action: handleCycleAgentReverse, - }) - commandRegistry.register({ id: "open-model-selector", label: "Open Model Selector", @@ -503,54 +483,6 @@ const App: Component = () => { commandRegistry.execute(commandId) } - function handleCycleAgent() { - const instance = activeInstance() - const sessionId = activeSessionIdForInstance() - if (!instance || !sessionId || sessionId === "logs") return - - const sessions = getSessions(instance.id) - const session = sessions.find((s) => s.id === sessionId) - if (!session) return - - const instanceAgents = agents().get(instance.id) || [] - const availableAgents = - session.parentId === null ? instanceAgents.filter((a) => a.mode !== "subagent") : instanceAgents - - if (availableAgents.length === 0) return - - const currentIndex = availableAgents.findIndex((a) => a.name === session.agent) - const nextIndex = (currentIndex + 1) % availableAgents.length - const nextAgent = availableAgents[nextIndex] - - if (nextAgent) { - updateSessionAgent(instance.id, sessionId, nextAgent.name).catch(console.error) - } - } - - function handleCycleAgentReverse() { - const instance = activeInstance() - const sessionId = activeSessionIdForInstance() - if (!instance || !sessionId || sessionId === "logs") return - - const sessions = getSessions(instance.id) - const session = sessions.find((s) => s.id === sessionId) - if (!session) return - - const instanceAgents = agents().get(instance.id) || [] - const availableAgents = - session.parentId === null ? instanceAgents.filter((a) => a.mode !== "subagent") : instanceAgents - - if (availableAgents.length === 0) return - - const currentIndex = availableAgents.findIndex((a) => a.name === session.agent) - const prevIndex = currentIndex <= 0 ? availableAgents.length - 1 : currentIndex - 1 - const prevAgent = availableAgents[prevIndex] - - if (prevAgent) { - updateSessionAgent(instance.id, sessionId, prevAgent.name).catch(console.error) - } - } - onMount(() => { initMarkdown(false).catch(console.error) @@ -576,8 +508,6 @@ const App: Component = () => { }, ) registerAgentShortcuts( - handleCycleAgent, - handleCycleAgentReverse, () => { const modelInput = document.querySelector("[data-model-selector]") as HTMLInputElement if (modelInput) { diff --git a/src/components/agent-selector.tsx b/src/components/agent-selector.tsx index e555ce1b..cf8e4ed4 100644 --- a/src/components/agent-selector.tsx +++ b/src/components/agent-selector.tsx @@ -102,16 +102,9 @@ export default function AgentSelector(props: AgentSelectorProps) { -
- 1}> - - Tab - - - - - -
+ + + ) } diff --git a/src/components/model-selector.tsx b/src/components/model-selector.tsx index a3ac4418..9f1b8dfe 100644 --- a/src/components/model-selector.tsx +++ b/src/components/model-selector.tsx @@ -101,10 +101,17 @@ export default function ModelSelector(props: ModelSelectorProps) { - Model: {currentModelValue()?.name ?? "None"} - +
+ Model: {currentModelValue()?.name ?? "None"} + {currentModelValue() && ( + + {currentModelValue()!.providerId}/{currentModelValue()!.id} + + )} +
+
diff --git a/src/lib/shortcuts/agent.ts b/src/lib/shortcuts/agent.ts index d12afa59..26b8297b 100644 --- a/src/lib/shortcuts/agent.ts +++ b/src/lib/shortcuts/agent.ts @@ -1,39 +1,8 @@ import { keyboardRegistry } from "../keyboard-registry" -export function registerAgentShortcuts( - cycleAgent: () => void, - cycleAgentReverse: () => void, - focusModelSelector: () => void, - openAgentSelector: () => void, -) { +export function registerAgentShortcuts(focusModelSelector: () => void, openAgentSelector: () => void) { const isMac = () => navigator.platform.toLowerCase().includes("mac") - keyboardRegistry.register({ - id: "agent-next", - key: "Tab", - modifiers: {}, - handler: cycleAgent, - description: "next agent", - context: "global", - condition: () => { - const active = document.activeElement - return !(active?.tagName === "TEXTAREA" || active?.tagName === "INPUT" || active?.hasAttribute("contenteditable")) - }, - }) - - keyboardRegistry.register({ - id: "agent-prev", - key: "Tab", - modifiers: { shift: true }, - handler: cycleAgentReverse, - description: "previous agent", - context: "global", - condition: () => { - const active = document.activeElement - return !(active?.tagName === "TEXTAREA" || active?.tagName === "INPUT" || active?.hasAttribute("contenteditable")) - }, - }) - keyboardRegistry.register({ id: "focus-model", key: "M",