mirror of
https://github.com/garrytan/gbrain.git
synced 2026-07-28 14:59:47 +00:00
Takeover of #2847 (rebased onto current master). Fixes #2826. - cjk.ts: estimateEmbeddingTokens() — conservative per-char-class token estimate (CJK 1.0, other 0.75, whitespace 0.1 per code unit). - recursive.ts (MARKDOWN_CHUNKER_VERSION 3→4): countWords floored at ceil(nonWhitespaceChars/6); capByEstimatedTokens() final pass with ChunkOptions.maxTokens (default 1500). - code.ts (CHUNKER_VERSION 4→5): capCodeChunks() applies the same cap to AST-path chunks that splitLargeNode can't subdivide. Co-authored-by: paul-0320 <paul-0320@users.noreply.github.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>