@@ -4,7 +4,7 @@ import { UrlContentFetcher } from "../../services/browser/UrlContentFetcher"
44import { FileContextTracker } from "../context-tracking/FileContextTracker"
55
66/**
7- * Process mentions in user content, specifically within task and feedback tags
7+ * Process mentions in all user content uniformly (text and tool_result text blocks).
88 */
99export async function processUserContentMentions ( {
1010 userContent,
@@ -35,14 +35,27 @@ export async function processUserContentMentions({
3535 // 3. ToolResultBlockParam's array content where blocks are text type
3636 return Promise . all (
3737 userContent . map ( async ( block ) => {
38- const shouldProcessMentions = ( _text : string ) => true
39-
4038 if ( block . type === "text" ) {
41- if ( shouldProcessMentions ( block . text ) ) {
39+ return {
40+ ...block ,
41+ text : await parseMentions (
42+ block . text ,
43+ cwd ,
44+ urlContentFetcher ,
45+ fileContextTracker ,
46+ rooIgnoreController ,
47+ showRooIgnoredFiles ,
48+ includeDiagnosticMessages ,
49+ maxDiagnosticMessages ,
50+ maxReadFileLine ,
51+ ) ,
52+ }
53+ } else if ( block . type === "tool_result" ) {
54+ if ( typeof block . content === "string" ) {
4255 return {
4356 ...block ,
44- text : await parseMentions (
45- block . text ,
57+ content : await parseMentions (
58+ block . content ,
4659 cwd ,
4760 urlContentFetcher ,
4861 fileContextTracker ,
@@ -53,33 +66,10 @@ export async function processUserContentMentions({
5366 maxReadFileLine ,
5467 ) ,
5568 }
56- }
57-
58- return block
59- } else if ( block . type === "tool_result" ) {
60- if ( typeof block . content === "string" ) {
61- if ( shouldProcessMentions ( block . content ) ) {
62- return {
63- ...block ,
64- content : await parseMentions (
65- block . content ,
66- cwd ,
67- urlContentFetcher ,
68- fileContextTracker ,
69- rooIgnoreController ,
70- showRooIgnoredFiles ,
71- includeDiagnosticMessages ,
72- maxDiagnosticMessages ,
73- maxReadFileLine ,
74- ) ,
75- }
76- }
77-
78- return block
7969 } else if ( Array . isArray ( block . content ) ) {
8070 const parsedContent = await Promise . all (
8171 block . content . map ( async ( contentBlock ) => {
82- if ( contentBlock . type === "text" && shouldProcessMentions ( contentBlock . text ) ) {
72+ if ( contentBlock . type === "text" ) {
8373 return {
8474 ...contentBlock ,
8575 text : await parseMentions (
0 commit comments