Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat: live reputation nudge on the agent screen

zprv37a081c9f424
diff --git a/src/agent-screen-reputation.js b/src/agent-screen-reputation.js
index 7a2012bc4..a8327e638 100644
--- a/src/agent-screen-reputation.js
+++ b/src/agent-screen-reputation.js
@@ -160,11 +160,16 @@ function ensureStyles() {
* @param {HTMLElement} opts.bodyEl
* @returns {{ refresh():void, observeHire():void, destroy():void }}
*/
-export function createReputationPanel({ agentId, bodyEl }) {
+export function createReputationPanel({ agentId, bodyEl, onNewReceipt = null }) {
ensureReputationStyles();
ensureStyles();
bodyEl.classList.add('ascrep-body');
+ // Receipt ids seen so far, so a refresh can tell a genuinely NEW hire from the
+ // ones already on screen and fire the live nudge only for real new activity.
+ const _seen = new Set();
+ let _initialized = false;
+
// Layer 1: the shared trust breakdown (loads its own real data).
const breakdown = reputationPanelEl(agentId, { unlocks: false });
bodyEl.appendChild(breakdown);
@@ -196,6 +201,7 @@ export function createReputationPanel({ agentId, bodyEl }) {
const { data } = await res.json();
const hires = Array.isArray(data?.hires) ? data.hires : [];
_loaded = true;
+ detectNew(hires);
render(hires);
} catch {
receipts.innerHTML =
@@ -208,6 +214,21 @@ export function createReputationPanel({ agentId, bodyEl }) {
}
}
+ // Compare against the receipts we've already shown and, after the first load,
+ // surface the newest genuinely-new hire as a live nudge. The very first load
+ // only seeds the baseline so we never replay history as "new".
+ function detectNew(hires) {
+ const fresh = hires.filter((h) => h.id && !_seen.has(h.id));
+ for (const h of hires) if (h.id) _seen.add(h.id);
+ if (!_initialized) {
+ _initialized = true;
+ return;
+ }
+ if (!fresh.length || typeof onNewReceipt !== 'function') return;
+ // hires are newest-first; the first fresh one is the most recent.
+ onNewReceipt(fresh[0]);
+ }
+
function render(hires) {
if (!hires.length) {
receipts.innerHTML =
@@ -225,6 +246,13 @@ export function createReputationPanel({ agentId, bodyEl }) {
load();
+ // Reputation moves slowly, and the receipts that earn it (this agent being
+ // hired) arrive without a frame on this screen — so poll on a calm cadence to
+ // pick them up. Pauses while the tab is hidden; detectNew() fires the nudge.
+ const _poll = setInterval(() => {
+ if (typeof document === 'undefined' || !document.hidden) load();
+ }, 60_000);
+
// Refresh the receipts when this agent settles a new hire (an a2a_hire frame
// reaches the screen log). Debounced so a burst of frames is one refetch.
let _hireT = null;
@@ -238,6 +266,7 @@ export function createReputationPanel({ agentId, bodyEl }) {
observeHire,
destroy() {
clearTimeout(_hireT);
+ clearInterval(_poll);
},
};
}
diff --git a/src/agent-screen.js b/src/agent-screen.js
index a20ae7df1..591951049 100644
--- a/src/agent-screen.js
+++ b/src/agent-screen.js
@@ -2991,6 +2991,15 @@ async function boot(id) {
reputationPanel = createReputationPanel({
agentId: id,
bodyEl: document.getElementById('asc-reputation-body'),
+ // Live nudge: a genuinely new hire receipt is real reputation movement —
+ // surface it in the activity log (type:'analysis') and as a toast so the
+ // climb shows even if the panel is closed.
+ onNewReceipt(h) {
+ const skill = truncMid(h.skill_name || h.service_slug || 'a hire', 22);
+ const stars = h.rating != null ? `${h.rating}★ ` : '';
+ addLogEntry({ ts: Date.now(), activity: `New ${stars}feedback on ${skill} — reputation climbing`, type: 'analysis' });
+ toast(`New ${stars}hire receipt · reputation +`);
+ },
});
function setPanelHidden(name, hidden) {