Skip to content

The agent that grows with you

fix(tui): keep a referenced skill styled in the sent message

Brooklyn Nicholson07244c5ead7c
diff --git a/ui-tui/src/components/messageLine.tsx b/ui-tui/src/components/messageLine.tsx
index d392ca94583..09b1c78a1ad 100644
--- a/ui-tui/src/components/messageLine.tsx
+++ b/ui-tui/src/components/messageLine.tsx
@@ -7,6 +7,7 @@ import { hasLeadGap } from '../domain/blockLayout.js'
import { sectionMode } from '../domain/details.js'
import { userDisplay } from '../domain/messages.js'
import { ROLE } from '../domain/roles.js'
+import { splitSlashSkillRefs } from '../domain/slash.js'
import { transcriptBodyWidth, transcriptGutterWidth } from '../lib/inputMetrics.js'
import {
boundedLiveRenderText,
@@ -204,6 +205,27 @@ export const MessageLine = memo(function MessageLine({
)
}
+ // A skill the user referenced mid-prose (`clean this up with /clean`)
+ // keeps the accent it wore as a completion in the composer, instead of
+ // flattening back into the body text.
+ if (msg.role === 'user') {
+ const segments = splitSlashSkillRefs(msg.text)
+
+ return (
+ <Text {...(body ? { color: body } : {})}>
+ {segments.map((segment, i) =>
+ segment.ref ? (
+ <Text color={t.color.accent} key={i}>
+ {segment.text}
+ </Text>
+ ) : (
+ segment.text
+ )
+ )}
+ </Text>
+ )
+ }
+
return <Text {...(body ? { color: body } : {})}>{msg.text}</Text>
})()