MCPcopy Create free account
hub / github.com/Roy3838/Observer / extractValidAgentReferencesWithPositions

Function extractValidAgentReferencesWithPositions

app/src/utils/agentParser.ts:316–327  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

314 * @returns Array of references with position info, only for valid agents
315 */
316export async function extractValidAgentReferencesWithPositions(text: string): Promise<Array<{
317 reference: AgentReference;
318 start: number;
319 end: number;
320 fullMatch: string;
321}>> {
322 const validAgentIds = await getAllAgentIds();
323 const validIdSet = new Set(validAgentIds);
324
325 const allRefs = extractAgentReferencesWithPositions(text);
326 return allRefs.filter(ref => validIdSet.has(ref.reference.agentId));
327}
328
329/**
330 * Detects partial @agent typing for suggestions

Callers

nothing calls this directly

Calls 3

getAllAgentIdsFunction · 0.90
filterMethod · 0.80

Tested by

no test coverage detected