Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
/** Minimal valid image headers for image-generation tests. */
export function pngBytes(width: number, height: number): Uint8Array {
const bytes = new Uint8Array(33);
bytes.set([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], 0);
bytes.set([0, 0, 0, 13], 8);
bytes.set([0x49, 0x48, 0x44, 0x52], 12);
new DataView(bytes.buffer).setUint32(16, width);
new DataView(bytes.buffer).setUint32(20, height);
return bytes;
}
export function jpegBytes(width: number, height: number): Uint8Array {
// SOI, APP0 (length 16), SOF0 with height/width, EOI.
const app0 = [0xff, 0xe0, 0x00, 0x10, ...Array.from({ length: 14 }, () => 0)];
const sof0 = [
0xff,
0xc0,
0x00,
0x11,
0x08,
(height >> 8) & 0xff,
height & 0xff,
(width >> 8) & 0xff,
width & 0xff,
0x03,
...Array.from({ length: 9 }, () => 0),
];
return new Uint8Array([0xff, 0xd8, ...app0, ...sof0, 0xff, 0xd9]);
}
export function base64(bytes: Uint8Array): string {
return Buffer.from(bytes).toString("base64");
}