32fb2cdeaf
Add chat file/image upload UX, attachment proxying, vision thumbnails, and per-turn image scoping so agents only use the current upload. Extend MindSpace asset context, billing token state, OA/scenario verify scripts, and related runtime config. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
772 B
JavaScript
25 lines
772 B
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import sharp from 'sharp';
|
|
import { buildVisionThumbnailBuffer, VISION_THUMB_MAX_SIDE } from './vision-image-thumb.mjs';
|
|
|
|
test('buildVisionThumbnailBuffer returns smaller jpeg payload for large png input', async () => {
|
|
const png = await sharp({
|
|
create: {
|
|
width: 3200,
|
|
height: 2400,
|
|
channels: 3,
|
|
background: { r: 120, g: 80, b: 200 },
|
|
},
|
|
})
|
|
.png()
|
|
.toBuffer();
|
|
|
|
const thumb = await buildVisionThumbnailBuffer(png, 'image/png');
|
|
const metadata = await sharp(thumb).metadata();
|
|
|
|
assert.equal(metadata.format, 'jpeg');
|
|
assert.ok(thumb.length < png.length);
|
|
assert.ok(Math.max(metadata.width ?? 0, metadata.height ?? 0) <= VISION_THUMB_MAX_SIDE);
|
|
});
|