Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/project-mate-interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ function attachMateInteraction(ctx) {
}

session._mentionInProgress = true;
session._mentionActiveMateId = msg.mateId;

// Send mention start indicator
sendToSession(session.localId, {
Expand Down Expand Up @@ -478,6 +479,7 @@ function attachMateInteraction(ctx) {
},
onDone: function (fullText) {
session._mentionInProgress = false;
session._mentionActiveMateId = null;

// Save mention response to session history
var mentionResponseEntry = {
Expand Down Expand Up @@ -512,6 +514,7 @@ function attachMateInteraction(ctx) {
},
onError: function (errMsg) {
session._mentionInProgress = false;
session._mentionActiveMateId = null;
// Clean up dead session
if (session._mentionSessions && session._mentionSessions[msg.mateId]) {
delete session._mentionSessions[msg.mateId];
Expand Down Expand Up @@ -610,6 +613,7 @@ function attachMateInteraction(ctx) {
}
}).catch(function (err) {
session._mentionInProgress = false;
session._mentionActiveMateId = null;
console.error("[mention] Failed to create session for mate " + msg.mateId + ":", err.message || err);
sendToSession(session.localId, { type: "mention_error", mateId: msg.mateId, error: "Failed to create mention session." });
});
Expand Down
1 change: 1 addition & 0 deletions lib/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ function createProjectContext(opts) {
delete session._mentionSessions[mateId];
}
session._mentionInProgress = false;
session._mentionActiveMateId = null;
sendToSession(session.localId, { type: "mention_done", mateId: mateId, stopped: true });
send({ type: "mention_processing", mateId: mateId, active: false });
}
Expand Down
5 changes: 4 additions & 1 deletion lib/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { avatarUrl, userAvatarUrl, mateAvatarUrl } from './modules/avatar.js';
import { showToast, copyToClipboard, escapeHtml } from './modules/utils.js';
import { refreshIcons, iconHtml } from './modules/icons.js';
import { renderMarkdown, highlightCodeBlocks, renderMermaidBlocks, closeMermaidModal, parseEmojis } from './modules/markdown.js';
import { initSidebar, renderSessionList, handleSearchResults, updateSessionPresence, updatePageTitle, populateCliSessionList, renderIconStrip, renderSidebarPresence, initIconStrip, getEmojiCategories, renderUserStrip, setCurrentDmUser, updateDmBadge, updateSessionBadge, updateProjectBadge, closeDmUserPicker, spawnDustParticles, openMobileSheet, setMobileSheetMateData, refreshMobileChatSheet } from './modules/sidebar.js';
import { initSidebar, renderSessionList, handleSearchResults, updateSessionPresence, updatePageTitle, populateCliSessionList, renderIconStrip, renderSidebarPresence, initIconStrip, getEmojiCategories, renderUserStrip, setCurrentDmUser, updateDmBadge, updateSessionBadge, updateProjectBadge, closeDmUserPicker, spawnDustParticles, openMobileSheet, setMobileSheetMateData, refreshMobileChatSheet, setMentionActive, clearAllMentionActive } from './modules/sidebar.js';
import { initMateSidebar, showMateSidebar, hideMateSidebar, renderMateSessionList, updateMateSidebarProfile, handleMateSearchResults } from './modules/mate-sidebar.js';
import { initMateKnowledge, requestKnowledgeList, renderKnowledgeList, handleKnowledgeContent, hideKnowledge } from './modules/mate-knowledge.js';
import { initMateMemory, renderMemoryList, hideMemory } from './modules/mate-memory.js';
Expand Down Expand Up @@ -2332,6 +2332,7 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
currentFullText = "";
resetToolState();
clearPendingImages();
clearAllMentionActive();
activityEl = null;
processing = false;
turnCounter = 0;
Expand Down Expand Up @@ -5064,6 +5065,8 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
renderUserStrip: renderUserStrip,
openMobileSheet: openMobileSheet,
setMobileSheetMateData: setMobileSheetMateData,
setMentionActive: setMentionActive,
updateCrossProjectBlink: updateCrossProjectBlink,
closeDmUserPicker: closeDmUserPicker,
getProfileLang: getProfileLang,
isSchedulerOpen: isSchedulerOpen,
Expand Down
2 changes: 2 additions & 0 deletions lib/public/modules/app-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,7 @@ export function processMessage(msg) {
case "mention_processing":
// Broadcast: show/hide activity dot on mate avatar across all tabs
if (msg.mateId) {
_ctx.setMentionActive(msg.mateId, msg.active);
var mateContainers = document.querySelectorAll('.icon-strip-mate[data-user-id="' + msg.mateId + '"]');
for (var mi = 0; mi < mateContainers.length; mi++) {
var dot = mateContainers[mi].querySelector(".icon-strip-status");
Expand All @@ -1187,6 +1188,7 @@ export function processMessage(msg) {
mateContainers[mi].classList.remove("mention-active");
}
}
_ctx.updateCrossProjectBlink();
}
break;

Expand Down
14 changes: 13 additions & 1 deletion lib/public/modules/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4007,6 +4007,16 @@ var dmPickerOpen = false;

var cachedDmRemovedUsers = {};
var cachedMates = [];
var activeMentionMateIds = {};

export function setMentionActive(mateId, active) {
if (active) { activeMentionMateIds[mateId] = true; }
else { delete activeMentionMateIds[mateId]; }
}

export function clearAllMentionActive() {
activeMentionMateIds = {};
}

export function renderUserStrip(allUsers, onlineUserIds, myUserId, dmFavorites, dmConversations, dmUnread, dmRemovedUsers, matesList) {
cachedMates = matesList || cachedMates || [];
Expand Down Expand Up @@ -4146,7 +4156,9 @@ export function renderUserStrip(allUsers, onlineUserIds, myUserId, dmFavorites,
// Processing status dot (IO blink)
var statusDot = document.createElement("span");
statusDot.className = "icon-strip-status";
if (mateProj.isProcessing) statusDot.classList.add("processing");
var isMentionActive = !!activeMentionMateIds[mate.id];
if (mateProj.isProcessing || isMentionActive) statusDot.classList.add("processing");
if (isMentionActive) el.classList.add("mention-active");
el.appendChild(statusDot);

// Mate badge (bot icon)
Expand Down
5 changes: 5 additions & 0 deletions lib/sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,11 @@ function createSessionManager(opts) {
decisionReason: p.decisionReason,
});
}

// Re-send active mention indicator so returning clients restore the mate avatar state
if (session._mentionInProgress && session._mentionActiveMateId) {
_send({ type: "mention_processing", mateId: session._mentionActiveMateId, active: true });
}
}

function cleanupMentionSessions(session) {
Expand Down