Skip to content
Closed
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
20 changes: 18 additions & 2 deletions static/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -7247,6 +7247,14 @@ function renderMessages(options){
}
}

const _MEMORY_SKILL_TOOLS = new Set(['memory', 'skill_manage']);
const _MEMORY_SKILL_WRITE_ACTIONS = new Set(['save', 'create', 'update', 'upsert']);
function _isMemorySkillWrite(tc) {
if (!tc || !_MEMORY_SKILL_TOOLS.has(tc.name)) return false;
if (tc.done === false || tc.is_error) return false;
const action = tc.args && (tc.args.action || tc.args.command || '');
Comment thread
rodboev marked this conversation as resolved.
return _MEMORY_SKILL_WRITE_ACTIONS.has(String(action).toLowerCase());
}
function _toolDisplayName(tc){
const name=(tc&&tc.name)||'tool';
if(name==='subagent_progress') return 'Subagent';
Expand Down Expand Up @@ -7379,6 +7387,7 @@ function buildToolCard(tc){
</div>`:''}
</div>`:''}
</div>`;
row._tcData = tc;
return row;
}

Expand Down Expand Up @@ -7428,9 +7437,16 @@ function _syncToolCallGroupSummary(group){
const label=group.querySelector('.tool-call-group-label');
const durationEl=group.querySelector('.tool-call-group-duration');
if(label){
const allRows = Array.from(group.querySelectorAll('.tool-card-row'));
const memCount = allRows.filter(c => c._tcData && _isMemorySkillWrite(c._tcData) && c._tcData.name === 'memory').length;
const skillCount = allRows.filter(c => c._tcData && _isMemorySkillWrite(c._tcData) && c._tcData.name === 'skill_manage').length;
Comment thread
greptile-apps[bot] marked this conversation as resolved.
const otherCount = toolCount - memCount - skillCount;
let suffix = '';
if (memCount) suffix += `, ${memCount} ${memCount===1?'memory':'memories'} saved`;
if (skillCount) suffix += `, ${skillCount} ${skillCount===1?'skill':'skills'} updated`;
if(group.getAttribute('data-live-tool-call-group')==='1'){
label.textContent=toolCount?`Activity: ${toolCount} tool${toolCount===1?'':'s'}`:'Activity · Running';
}else if(toolCount) label.textContent=`Activity: ${toolCount} tool${toolCount===1?'':'s'}`;
label.textContent=otherCount?`Activity: ${otherCount} tool${otherCount===1?'':'s'}${suffix}`:(suffix?'Activity: '+suffix.slice(2):'Activity · Running');
}else if(otherCount||suffix) label.textContent=otherCount?`Activity: ${otherCount} tool${otherCount===1?'':'s'}${suffix}`:'Activity: '+suffix.slice(2);
else label.textContent='Activity';
label.setAttribute('data-sweep-label', label.textContent);
}
Expand Down
25 changes: 25 additions & 0 deletions tests/test_memory_skill_badge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import pathlib

_ROOT = pathlib.Path(__file__).resolve().parent.parent


def test_memory_skill_tools_constant():
src = (_ROOT / "static" / "ui.js").read_text(encoding="utf-8")
assert "_MEMORY_SKILL_TOOLS" in src
assert "'memory'" in src or '"memory"' in src


def test_is_memory_skill_write_helper():
src = (_ROOT / "static" / "ui.js").read_text(encoding="utf-8")
assert "_isMemorySkillWrite" in src


def test_sync_summary_includes_memory_suffix():
src = (_ROOT / "static" / "ui.js").read_text(encoding="utf-8")
assert "memories" in src
assert "saved" in src

Comment thread
rodboev marked this conversation as resolved.

def test_build_tool_card_attaches_tc_data():
src = (_ROOT / "static" / "ui.js").read_text(encoding="utf-8")
assert "_tcData" in src
Loading