/** * Hashline constants ported from Oh-My-OpenAgent. * * The hashline format is: `{line_number}#{hash_id}|{content}` * where hash_id is a 2-character code from the HASHLINE_DICT. */ export const NIBBLE_STR = "ZPMQVRWSNKTXJBYH"; /** Maps byte values (0-255) to 2-character hash IDs. */ export const HASHLINE_DICT: string[] = Array.from({ length: 256 }, (_, i) => { const high = i >>> 4; const low = i & 0x0f; return `${NIBBLE_STR[high]}${NIBBLE_STR[low]}`; }); /** Matches a line reference like `12#AB`. */ export const HASHLINE_REF_PATTERN = /^([0-9]+)#([ZPMQVRWSNKTXJBYH]{2})$/; /** Matches a full hashline output like `12#AB|content`. */ export const HASHLINE_OUTPUT_PATTERN = /^([0-9]+)#([ZPMQVRWSNKTXJBYH]{2})\|(.*)$/;