|
42 | 42 | margin-right: 2px; |
43 | 43 | } |
44 | 44 |
|
45 | | - .btn-reset { |
46 | | - padding: 2px 8px; |
47 | | - font-size: 10px; |
48 | | - font-family: var(--font-sans); |
49 | | - font-weight: 500; |
50 | | - color: var(--color-muted); |
51 | | - background: transparent; |
52 | | - border: 1px solid rgba(139, 148, 158, 0.35); |
53 | | - border-radius: 4px; |
54 | | - cursor: pointer; |
55 | | - text-transform: none; |
56 | | - letter-spacing: normal; |
57 | | - transition: background 0.15s, border-color 0.15s, color 0.15s; |
58 | | - } |
59 | | - |
60 | | - .btn-reset:hover { |
61 | | - color: var(--color-text); |
62 | | - background: rgba(139, 148, 158, 0.1); |
63 | | - border-color: rgba(139, 148, 158, 0.4); |
64 | | - } |
65 | | - |
66 | 45 | .panel-content { |
67 | 46 | flex: 1; |
68 | 47 | overflow-y: auto; |
|
543 | 522 | <span class="status-label">Dashboard Status:</span> |
544 | 523 | <span class="connection-label connecting" id="connection-label">CONNECTING</span> |
545 | 524 | </div> |
546 | | - <button class="btn-reset" id="btn-reset-demo" title="Reset demo to initial state">Reset Demo</button> |
547 | 525 | </div> |
548 | 526 | </div> |
549 | 527 | <div class="panel" id="panel-registry"> |
|
649 | 627 |
|
650 | 628 | switch (eventType) { |
651 | 629 | case 'agent.created': |
652 | | - return 'Agent ' + (attrs['agent.id'] || '') + ' provisioned'; |
| 630 | + return (attrs['user.id'] || '') + ' → ' + (attrs['agent.id'] || ''); |
653 | 631 | case 'agent.terminated': |
654 | 632 | return 'Agent ' + (attrs['agent.id'] || '') + ' terminated'; |
655 | 633 | case 'request.allowed': |
656 | 634 | return (attrs['http.host'] || '') + ' -- allowed'; |
657 | 635 | case 'request.denied': |
658 | 636 | return (attrs['http.host'] || '') + ' -- denied' + (attrs['denial.reason'] ? ': ' + attrs['denial.reason'] : ''); |
| 637 | + case 'agent.prompted': |
| 638 | + return (attrs['user.id'] || 'user') + ' → ' + (attrs['agent.id'] || 'agent'); |
659 | 639 | default: |
660 | 640 | if (attrs['agent.id']) return eventType + ' for ' + attrs['agent.id']; |
661 | 641 | return eventType; |
|
694 | 674 | const attrs = event.attributes || {}; |
695 | 675 | const agentId = attrs['agent.id'] || ''; |
696 | 676 |
|
697 | | - // Demo reset — clear all local state |
698 | | - if (eventType === 'demo.reset') { |
699 | | - clearAllDashboardState(); |
700 | | - return; |
701 | | - } |
702 | | - |
703 | 677 | // User lifecycle. Event names are speculative until the backend |
704 | 678 | // settles its vocabulary; the handler shape stays the same. |
705 | 679 | if (eventType === 'user.created') { |
|
711 | 685 | if (userId) Topology.removeUserNode(userId); |
712 | 686 | } |
713 | 687 |
|
714 | | - // User actions — light up the user→platform edge. |
715 | | - if (eventType === 'agent.requested' || eventType === 'prompt.sent' || eventType === 'permission.change_requested' || eventType === 'termination.requested') { |
| 688 | + // agent.prompted: user→platform then platform→agent sequentially |
| 689 | + if (eventType === 'agent.prompted') { |
716 | 690 | const userId = attrs['user.id'] || ''; |
717 | | - if (userId) { |
718 | | - Topology.highlightEdge(userId, Topology.EDGE_HIGHLIGHT_MS); |
719 | | - } |
| 691 | + if (userId) Topology.highlightEdge(userId, Topology.EDGE_HIGHLIGHT_MS); |
| 692 | + if (agentId) setTimeout(() => Topology.highlightEdge('platform-' + agentId, Topology.EDGE_HIGHLIGHT_MS), 400); |
720 | 693 | } |
721 | 694 |
|
722 | 695 | // Agent lifecycle. Light up the platform→agent edge: the platform is |
|
731 | 704 | Topology.removeAgentRuntimeNode(agentId); |
732 | 705 | } |
733 | 706 |
|
734 | | - // Prompt delivered: platform exec'd into the agent via the supervisor. |
735 | | - if (eventType === 'agent.prompted') { |
736 | | - if (agentId) Topology.highlightEdge('platform-' + agentId, Topology.EDGE_HIGHLIGHT_MS); |
737 | | - } |
738 | | - |
739 | 707 | // Gateway decisions |
740 | 708 | if (eventType === 'auth.allowed' || eventType === 'request.allowed' || eventType === 'request.denied' || eventType === 'permission.checked') { |
741 | 709 | const decision = { |
|
866 | 834 | else startRegistryPolling(); |
867 | 835 | }); |
868 | 836 |
|
869 | | - // ============================================================ |
870 | | - // Reset button |
871 | | - // ============================================================ |
872 | | - document.getElementById('btn-reset-demo').addEventListener('click', async () => { |
873 | | - const btn = document.getElementById('btn-reset-demo'); |
874 | | - btn.disabled = true; |
875 | | - btn.textContent = 'Resetting...'; |
876 | | - |
877 | | - try { |
878 | | - const res = await fetch('/api/reset', { method: 'POST' }); |
879 | | - if (res.ok) { |
880 | | - clearAllDashboardState(); |
881 | | - } |
882 | | - } catch (err) { |
883 | | - console.error('Reset failed:', err); |
884 | | - } finally { |
885 | | - btn.disabled = false; |
886 | | - btn.textContent = 'Reset Demo'; |
887 | | - } |
888 | | - }); |
889 | | - |
890 | 837 | // ============================================================ |
891 | 838 | // Init |
892 | 839 | // ============================================================ |
|
0 commit comments