fix: Surface active architect agents in initiative activity state

Auto-spawned discuss/plan/refine agents were invisible because:
1. listInitiatives only filtered for mode='detail' agents
2. deriveInitiativeActivity returned 'idle' for zero phases before
   checking for active agents

Broadened agent filter to all architect modes (discuss, plan, detail,
refine), moved active agent check before zero-phases early return, and
added 'discussing'/'refining' activity states with pulsing indicators.
This commit is contained in:
Lukas May
2026-03-03 14:12:20 +01:00
parent e4289659cd
commit 3d04cb2081
5 changed files with 34 additions and 20 deletions

View File

@@ -98,11 +98,12 @@ export function initiativeProcedures(publicProcedure: ProcedureBuilder) {
? await repo.findByStatus(input.status)
: await repo.findAll();
// Fetch active detail agents once for all initiatives
// Fetch active architect agents once for all initiatives
const ARCHITECT_MODES = ['discuss', 'plan', 'detail', 'refine'];
const allAgents = ctx.agentManager ? await ctx.agentManager.list() : [];
const activeDetailAgents = allAgents
const activeArchitectAgents = allAgents
.filter(a =>
a.mode === 'detail'
ARCHITECT_MODES.includes(a.mode ?? '')
&& (a.status === 'running' || a.status === 'waiting_for_input')
&& !a.userDismissedAt,
)
@@ -112,13 +113,13 @@ export function initiativeProcedures(publicProcedure: ProcedureBuilder) {
const phaseRepo = ctx.phaseRepository;
return Promise.all(initiatives.map(async (init) => {
const phases = await phaseRepo.findByInitiativeId(init.id);
return { ...init, activity: deriveInitiativeActivity(init, phases, activeDetailAgents) };
return { ...init, activity: deriveInitiativeActivity(init, phases, activeArchitectAgents) };
}));
}
return initiatives.map(init => ({
...init,
activity: deriveInitiativeActivity(init, [], activeDetailAgents),
activity: deriveInitiativeActivity(init, [], activeArchitectAgents),
}));
}),