fix(web): cap default images at 5 MiB

This commit is contained in:
creatixchu
2026-08-12 14:47:20 +08:00
parent 8d4c3f8a0a
commit 51dc55ec3d
15 changed files with 21 additions and 20 deletions

View File

@@ -985,7 +985,7 @@ function projectionValuesOf(log: readonly SessionEvent[]): Record<string, unknow
// change frame (constant unit), but the fixture's uniform baseline replay
// frames every key here, incidentally exercising higher-seq-wins.
values['imageLimits'] = {
maxImageBytes: 10 * 1024 * 1024,
maxImageBytes: 5 * 1024 * 1024,
maxImagesPerMessage: 20,
maxMessageImageBytes: 100 * 1024 * 1024,
maxImagePixels: 40_000_000,

View File

@@ -165,7 +165,7 @@ describe('createFixtureApi', () => {
messageTokens: 0,
},
imageLimits: {
maxImageBytes: 10 * 1024 * 1024,
maxImageBytes: 5 * 1024 * 1024,
maxImagesPerMessage: 20,
maxMessageImageBytes: 100 * 1024 * 1024,
maxImagePixels: 40_000_000,
@@ -383,7 +383,7 @@ describe('createFixtureApi', () => {
expect((first[8]?.payload as { value: { messageTokens: number } }).value.messageTokens).toBeGreaterThan(0)
expect(first[9]?.payload).toMatchObject({
type: 'session/projection', sessionId: 'fx-alpha', key: 'imageLimits',
value: { maxImagesPerMessage: 20, maxImageBytes: 10 * 1024 * 1024 },
value: { maxImagesPerMessage: 20, maxImageBytes: 5 * 1024 * 1024 },
})
expect(first[10]?.payload).toMatchObject({ type: 'approval/requested', toolName: 'dangerous_tool' })
expect(second[10]?.rpcId).toBe(first[10]?.rpcId) // stable rpcId across replays (host replay semantics)