docs(agent): annotate stream invariants

This commit is contained in:
Peter Steinberger
2026-01-05 18:10:03 +00:00
parent 86ad703f53
commit cc790f2c84
4 changed files with 13 additions and 0 deletions

View File

@@ -48,6 +48,8 @@ export class EmbeddedBlockChunker {
}
drain(params: { force: boolean; emit: (chunk: string) => void }) {
// KNOWN: We cannot split inside fenced code blocks (Markdown breaks + UI glitches).
// When forced (maxChars), we close + reopen the fence to keep Markdown valid.
const { force, emit } = params;
const minChars = Math.max(1, Math.floor(this.#chunking.minChars));
const maxChars = Math.max(minChars, Math.floor(this.#chunking.maxChars));