/** * Bounds on server-fed chat state. A hostile or malfunctioning gateway can * flood any of these collections; caps keep memory/render cost flat instead * of growing unboundedly for the lifetime of the connection. */ /** Max characters retained for the in-flight streamed text/thinking buffers. */ export const MAX_STREAM_CHARS = 20_000; /** Max transcript turns retained (oldest dropped first). */ export const MAX_MESSAGES = 500; /** Max tool-call entries (including anomaly entries) retained per turn history. */ export const MAX_TOOLS = 200; /** Max slash-command results retained. */ export const MAX_COMMAND_RESULTS = 200; /** Max commands/skills accepted from a single manifest push. */ export const MAX_MANIFEST_ITEMS = 500; /** Max executed approval IDs remembered for single-flight dedup. */ export const MAX_EXECUTED_APPROVAL_IDS = 200; /** Max characters retained for a single command:result message — a hostile * or malfunctioning gateway must not be able to push an unbounded curated * success/failure reason into state (or, defensively, onto the page). */ export const MAX_COMMAND_MESSAGE_CHARS = 1_000;