From 35c2e257ef945dbff199210d4c3a22423709c8a1 Mon Sep 17 00:00:00 2001 From: Greg Soucy Date: Sat, 23 May 2026 17:19:24 -0400 Subject: [PATCH] Add real publish agent cards action in claims admin --- public/admin/claims.html | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/public/admin/claims.html b/public/admin/claims.html index c951bdd..62df533 100644 --- a/public/admin/claims.html +++ b/public/admin/claims.html @@ -67,6 +67,29 @@

CommandLayer Claims Admin

await loadDetail(selectedClaimId); await loadClaims(); } + + async function publishAgentCards(claimId) { + const res = await fetch('/api/admin/publish-agent-cards', { + method: 'POST', + headers: authHeaders(), + body: JSON.stringify({ claimId, actor: 'admin' }) + }); + const data = await res.json(); + if (!res.ok || !data.ok) { + claimActionError = { + status: data.status || 'REQUEST_FAILED', + error: data.error || 'Request failed.', + debug: data.debug || null, + action: 'publish-agent-cards' + }; + await loadDetail(claimId); + return; + } + claimActionError = null; + await loadDetail(claimId); + await loadClaims(); + } + async function loadDetail(claimId) { selectedClaimId = claimId; const res = await fetch(`/api/admin/claim?claimId=${encodeURIComponent(claimId)}`, { headers: { Authorization: authHeaders().Authorization } }); @@ -94,7 +117,7 @@

Agents

${JSON.stringify(data.agents || [], null, 2)}
`; } const mk = (label, cb) => { const b = document.createElement('button'); b.textContent = label; b.addEventListener('click', cb); actionRow.appendChild(b); }; if (status === 'created') { mk('Approve', () => claimAction('approve', { notes: document.getElementById('notesInput').value })); mk('Reject', () => claimAction('reject', { reason: document.getElementById('reasonInput').value })); mk('Mark failed', () => claimAction('mark_failed', { reason: document.getElementById('reasonInput').value })); } - if (status === 'approved') { document.getElementById('nextStep').textContent = 'Next: Publish agent cards (placeholder)'; mk('Mark failed', () => claimAction('mark_failed', { reason: document.getElementById('reasonInput').value })); } + if (status === 'approved') { document.getElementById('nextStep').textContent = 'Next: Publish agent cards.'; mk('Publish agent cards', () => publishAgentCards(selectedClaimId)); mk('Mark failed', () => claimAction('mark_failed', { reason: document.getElementById('reasonInput').value })); } if (status === 'rejected') { mk('Reopen / Approve (override)', () => claimAction('approve', { override: true, reason: document.getElementById('reasonInput').value, notes: document.getElementById('notesInput').value })); mk('Mark failed', () => claimAction('mark_failed', { reason: document.getElementById('reasonInput').value })); } if (status === 'failed') { document.getElementById('nextStep').textContent = 'Failed status: auto-retry is not enabled yet.'; } document.getElementById('saveNoteBtn').addEventListener('click', () => claimAction('add_note', { notes: document.getElementById('notesInput').value, reason: document.getElementById('reasonInput').value }));