Skip to content

Commit d3bec25

Browse files
committed
Update agent lifecycle event handling in topology
1 parent eb98349 commit d3bec25

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

public/index.html

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -649,13 +649,15 @@
649649

650650
switch (eventType) {
651651
case 'agent.created':
652-
return 'Agent ' + (attrs['agent.id'] || '') + ' provisioned';
652+
return (attrs['user.id'] || '') + ' → ' + (attrs['agent.id'] || '');
653653
case 'agent.terminated':
654654
return 'Agent ' + (attrs['agent.id'] || '') + ' terminated';
655655
case 'request.allowed':
656656
return (attrs['http.host'] || '') + ' -- allowed';
657657
case 'request.denied':
658658
return (attrs['http.host'] || '') + ' -- denied' + (attrs['denial.reason'] ? ': ' + attrs['denial.reason'] : '');
659+
case 'agent.prompted':
660+
return (attrs['user.id'] || 'user') + ' → ' + (attrs['agent.id'] || 'agent');
659661
default:
660662
if (attrs['agent.id']) return eventType + ' for ' + attrs['agent.id'];
661663
return eventType;
@@ -711,12 +713,11 @@
711713
if (userId) Topology.removeUserNode(userId);
712714
}
713715

714-
// User actions — light up the user→platform edge.
715-
if (eventType === 'agent.requested' || eventType === 'prompt.sent' || eventType === 'permission.change_requested' || eventType === 'termination.requested') {
716+
// agent.prompted: user→platform then platform→agent sequentially
717+
if (eventType === 'agent.prompted') {
716718
const userId = attrs['user.id'] || '';
717-
if (userId) {
718-
Topology.highlightEdge(userId, Topology.EDGE_HIGHLIGHT_MS);
719-
}
719+
if (userId) Topology.highlightEdge(userId, Topology.EDGE_HIGHLIGHT_MS);
720+
if (agentId) setTimeout(() => Topology.highlightEdge('platform-' + agentId, Topology.EDGE_HIGHLIGHT_MS), 400);
720721
}
721722

722723
// Agent lifecycle. Light up the platform→agent edge: the platform is
@@ -731,11 +732,6 @@
731732
Topology.removeAgentRuntimeNode(agentId);
732733
}
733734

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-
739735
// Gateway decisions
740736
if (eventType === 'auth.allowed' || eventType === 'request.allowed' || eventType === 'request.denied' || eventType === 'permission.checked') {
741737
const decision = {

0 commit comments

Comments
 (0)