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

Function detectPartialAgentTyping

app/src/utils/agentParser.ts:355–373  ·  view source on GitHub ↗
(text: string, cursorPosition: number)

Source from the content-addressed store, hash-verified

353 * @returns Object with suggestion info or null
354 */
355export function detectPartialAgentTyping(text: string, cursorPosition: number): {
356 partialMatch: string;
357 start: number;
358 end: number;
359} | null {
360 // Look for @word pattern before cursor
361 const beforeCursor = text.substring(0, cursorPosition);
362 const match = beforeCursor.match(/@(\w*)$/);
363
364 if (match) {
365 return {
366 partialMatch: match[1], // The part after @
367 start: match.index! + 1, // Position after @
368 end: cursorPosition
369 };
370 }
371
372 return null;
373}
374
375/**
376 * Formats agent reference context for appending to a message

Callers 1

handleInputChangeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected