MCPcopy
hub / github.com/claude-code-best/claude-code / getActiveAgentForInput

Function getActiveAgentForInput

src/state/selectors.ts:59–76  ·  view source on GitHub ↗
(
  appState: AppState,
)

Source from the content-addressed store, hash-verified

57 * Used by input routing logic to direct user messages to the correct agent.
58 */
59export function getActiveAgentForInput(
60 appState: AppState,
61): ActiveAgentForInput {
62 const viewedTask = getViewedTeammateTask(appState)
63 if (viewedTask) {
64 return { type: 'viewed', task: viewedTask }
65 }
66
67 const { viewingAgentTaskId, tasks } = appState
68 if (viewingAgentTaskId) {
69 const task = tasks[viewingAgentTaskId]
70 if (task?.type === 'local_agent') {
71 return { type: 'named_agent', task }
72 }
73 }
74
75 return { type: 'leader' }
76}

Callers 2

useSwarmBannerFunction · 0.85
PromptInputFunction · 0.85

Calls 1

getViewedTeammateTaskFunction · 0.85

Tested by

no test coverage detected