UNPKG

automagik-cli

Version:

Automagik CLI - A powerful command-line interface for interacting with Automagik Hive multi-agent AI systems

19 lines (18 loc) 592 B
/** * Unicode-aware text utilities copied from gemini-cli * Work at the code-point level rather than UTF-16 code units * so that surrogate-pair emoji count as one "column" */ export function toCodePoints(str) { // [...str] or Array.from both iterate by UTF-32 code point, handling // surrogate pairs correctly. return Array.from(str); } export function cpLen(str) { return toCodePoints(str).length; } export function cpSlice(str, start, end) { // Slice by code-point indices and re-join. const arr = toCodePoints(str).slice(start, end); return arr.join(''); }