feat: keep track of agent ids

This commit is contained in:
Aarnav Tale
2025-03-06 17:37:41 -05:00
parent 5dd4c41291
commit d9314887fb
3 changed files with 14 additions and 8 deletions
+6 -3
View File
@@ -1,19 +1,22 @@
import type { HostInfo } from '~/types';
import { TimedCache } from '~server/ws/cache';
import { hp_agentRequest, hp_getAgentCache } from '~server/ws/data';
import { hp_getAgents } from '~server/ws/socket';
import { hp_getConfig } from './loader';
import type { HeadplaneConfig } from './parser';
export interface AppContext {
context: HeadplaneConfig;
agentData?: TimedCache<HostInfo>;
hp_agentRequest: typeof hp_agentRequest;
agents: string[];
agentData?: TimedCache<HostInfo>;
}
export default function appContext() {
export default function appContext(): AppContext {
return {
context: hp_getConfig(),
agentData: hp_getAgentCache(),
hp_agentRequest,
agents: [...hp_getAgents().keys()],
agentData: hp_getAgentCache(),
};
}