BBotEnvelope
AI coding workspace

Bot message chunking

A message limit counts something specific. BotEnvelope is a Windows coding workspace for examining chunk boundaries, text fixtures and adapter code with a compatible model, then reviewing what will actually be sent.

● ● ●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
  1. Project

    Check an emoji at the boundary, an empty message and fenced code, preserving the text when the chunks are joined.

  2. Review before applying

    Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

  3. Connection

    Base URL, credentials and a reachable server.

Workflows

Bot message chunking

Workflows ↗
A concrete starting point
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);
AI coding workspace

Your next change starts here.

Get the Windows app ↗