Add hub package

This commit is contained in:
2026-05-05 12:03:45 +00:00
commit 42f661beb9
20 changed files with 777 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
import * as plugins from '../plugins.js';
export class AgentRegistry {
private agents = [...plugins.shxAgents.referenceAgents];
private statuses: plugins.shxInterfaces.data.IAgentStatus[] = this.agents.map((agentArg) => ({
agentId: agentArg.id,
actionsToday: 0,
runningToolIds: [],
}));
public listAgents() {
return this.agents.filter((agentArg) => agentArg.enabled);
}
public getAgentById(agentIdArg: string) {
return this.agents.find((agentArg) => agentArg.id === agentIdArg);
}
public listStatuses() {
return [...this.statuses];
}
public recordAction(agentIdArg: string, latestArg: string) {
const status = this.statuses.find((statusArg) => statusArg.agentId === agentIdArg);
if (!status) {
return;
}
status.actionsToday++;
status.latest = latestArg;
}
}