BBotEnvelope
Product

Product features · Bot message chunking

01

Split a bot’s outgoing text at the configured UTF-16 length limit without separating a surrogate pair. Check an emoji at the boundary, an empty message and fenced code, preserving the text when the chunks are joined.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Bot message chunking

● ● ●BotEnvelope●
A concrete starting point · Bot message chunking ×
if (!Number.isInteger(start) || start < 0 || start > text.length) {
  throw new Error("start.invalid");
}
if (!Number.isInteger(limit) || limit < 1) throw new Error("limit.invalid");
if (start === text.length) return "";
let end = Math.min(start + limit, text.length);
const last = text.charCodeAt(end - 1);
if (end < text.length && last >= 0xD800 && last <= 0xDBFF) end--;
if (end === start) throw new Error("limit.too_small");
return text.slice(start, end);
✳Split a bot’s outgoing text at the configured UTF-16 length limit without separating a surrogate pair.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗