feat(agents): show last used by/at on card and settings#3302
Open
feat(agents): show last used by/at on card and settings#3302
Conversation
Contributor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Contributor
Release OptionsSuggested: Minor ( React with an emoji to override the release type:
Current version:
|
a0f147e to
87863ef
Compare
87863ef to
1f50efb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this contribution about?
Surfaces "last used" timestamps for agents on the agent card footer and the agent settings metadata line. Data comes from the most recent thread per agent.
The query lives behind a dedicated read-only tool (
VIRTUAL_MCP_LAST_USED_LIST) so it stays off the agent fetch hot path —findById/liston virtual MCPs are unchanged and pay no extra cost.What changed
Backend
VIRTUAL_MCP_LAST_USED_LIST(apps/mesh/src/tools/virtual/last-used-list.ts) — takes{ ids: string[] }, returns{ items: { id, last_used_at?, last_used_by? }[] }. Registered under the existing Basic Usage capability so all org members can read it.ThreadStoragePort.findLastUsedByVirtualMcpIds(orgId, ids)(apps/mesh/src/storage/threads.ts) — singleDISTINCT ON (virtual_mcp_id)query againstthreads, ordered bycreated_at DESC. Lives next to threads since that's the table queried.VirtualMCPEntityschema unchanged — no extra fields on the entity, no extra query when other code paths fetch agents.SDK
useVirtualMCPsLastUsed(ids: string[])in@decocms/mesh-sdk— returnsMap<id, { last_used_at?, last_used_by? }>. Disabled whenidsis empty. 30s staleTime.UI
ProjectCardaccepts an optionallastUsedAt?: stringprop. Shows "Last used X ago" when set, falls back to "Updated X ago" when no thread exists.agents-list.tsxcalls the hook once for all visible agents, passes the per-card timestamp down.virtual-mcp/index.tsx) calls the hook for the single agent. Metadata line shows:[avatar] Creator · Created May 6 · Last used X ago(or "Never used").How to Test
COLLECTION_VIRTUAL_MCP_GET,COLLECTION_VIRTUAL_MCP_LIST) are unchanged — the threads query only runs when the UI explicitly callsVIRTUAL_MCP_LAST_USED_LIST.Migration Notes
No database migrations required. The new tool reads from the existing
threadstable.Review Checklist