import { TextChunker } from './TextChunker.js';
export class MessageChunker {
    config;
    constructor(config) {
        this.config = config;
    }
    shouldChunk(message) {
        return JSON.stringify(message.content).length > this.config.maxChunkSize;
    }
    chunk(message) {
        return TextChunker.fixedCharacterLength(message.content || '', {
            chunkLength: this.config.maxChunkSize,
            overlap: 0.08 * this.config.maxChunkSize,
        }).map(chunk => JSON.stringify({
            ...message,
            content: chunk,
        }));
    }
}
