MCPcopy Index your code
hub / github.com/anomalyco/opencode / messageAgentColor

Function messageAgentColor

packages/app/src/utils/agent.ts:34–44  ·  view source on GitHub ↗
(
  list: readonly { role: string; agent?: string }[] | undefined,
  agents: readonly { name: string; color?: string }[],
)

Source from the content-addressed store, hash-verified

32}
33
34export function messageAgentColor(
35 list: readonly { role: string; agent?: string }[] | undefined,
36 agents: readonly { name: string; color?: string }[],
37) {
38 if (!list) return undefined
39 for (let i = list.length - 1; i >= 0; i--) {
40 const item = list[i]
41 if (item.role !== "user" || !item.agent) continue
42 return agentColor(item.agent, agents.find((agent) => agent.name === item.agent)?.color)
43 }
44}

Callers 2

SessionHeaderFunction · 0.90
SessionItemFunction · 0.90

Calls 2

agentColorFunction · 0.85
findMethod · 0.65

Tested by

no test coverage detected