chore: update channels

This commit is contained in:
Jack Wotherspoon
2026-03-27 13:09:59 -04:00
parent e10b2d708c
commit 78bd526792
8 changed files with 203 additions and 58 deletions
+1 -17
View File
@@ -1218,24 +1218,8 @@ Logging in with Google... Restarting Gemini CLI to continue.
const channelsEnabled = config.getChannels().length > 0;
useEffect(() => {
if (!channelsEnabled) return;
const escapeAttr = (s: string) =>
s
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
const handler = (payload: ChannelMessagePayload) => {
const meta = payload.metadata ?? {};
const user = meta['user'] ?? payload.sender;
const chatId = meta['chat_id'] ?? '';
const msgId = meta['message_id'] ?? '';
const imagePath = meta['image_path'] ?? '';
const safeContent = payload.content.replace(
/<\/channel>/gi,
'&lt;/channel&gt;',
);
const formatted = `<channel source="${escapeAttr(payload.channelName)}" chat_id="${escapeAttr(chatId)}" message_id="${escapeAttr(msgId)}" user="${escapeAttr(user)}"${imagePath ? ` image_path="${escapeAttr(imagePath)}"` : ''}>\n${safeContent}\n</channel>`;
addMessage(formatted);
addMessage(payload.content);
};
coreEvents.on(CoreEvent.ChannelMessage, handler);
return () => {
@@ -46,7 +46,11 @@ export const ChannelsList: React.FC<ChannelsListProps> = ({ channels }) => {
<Text color={theme.text.secondary}>
Direction:{' '}
<Text
color={channel.supportsReply ? 'green' : theme.text.secondary}
color={
channel.supportsReply
? theme.status.success
: theme.text.secondary
}
>
{channel.supportsReply ? 'two-way' : 'one-way'}
</Text>