Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

Merge remote-tracking branch 'origin/dev' into feat/678-desktop-upload-documents

Alfredo Lopezdd2a55b573e6
diff --cc control-api/package-lock.json
index f70bce446,f7f8d9ea8..418e0868b
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@@ -1,12 -1,12 +1,12 @@@
{
"name": "clerum-control-api",
- "version": "0.1.714",
- "version": "0.1.727",
++ "version": "0.1.728",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.714",
- "version": "0.1.727",
++ "version": "0.1.728",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",
diff --cc control-api/package.json
index d6b80060c,9eb9cb474..cc96d88dc
--- a/control-api/package.json
+++ b/control-api/package.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "clerum-control-api",
- "version": "0.1.714",
- "version": "0.1.727",
++ "version": "0.1.728",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --cc desktop-app/test/e2e-playwright/subscription-gfs-image.spec.ts
index 000000000,829097cb6..964288cb1
mode 000000,100644..100644
--- a/desktop-app/test/e2e-playwright/subscription-gfs-image.spec.ts
+++ b/desktop-app/test/e2e-playwright/subscription-gfs-image.spec.ts
@@@ -1,0 -1,251 +1,249 @@@
+ /**
+ * E2E_GUARDIAN_IPC_FLOW: visible login -> Files -> actual preview tabs -> owned
+ * Host/model -> EvenDrive chooser -> attach refs -> Send -> real version-pinned
+ * gfs_read results -> ordered pixel answer -> one durable two-message task.
+ * Main seeds only two isolated QA files and grants. No business API writes,
+ * browser state mutation or injected core response advances this journey.
+ */
+ import { randomUUID } from 'node:crypto'
+ import { openResourcesNavItem } from './navigationHelpers.js'
+ import { decodeTileChallenge } from './subscriptionImageChallenge.js'
+ import { expect, subscriptionImageRun as run, sha256, test } from './subscriptionImageFixtures.js'
+ import { preparedPixelCode, readRemainingFixture } from './subscriptionRemainingJourneyData.js'
+ import {
+ assertPixelVendorEvidence,
+ observeDurableTurn,
+ openOwnedChat,
+ outputPattern,
+ settledVisibleAnswer,
+ showCompletedTools,
+ submitVisibly,
+ } from './subscriptionRemainingJourneyUi.js'
+ import {
+ type GfsFixture,
+ requireRemainingJourney,
+ } from './subscriptionRemainingJourneysContract.js'
+
+ const input = requireRemainingJourney('gfs-image', run)
+ let fixtures: Record<string, GfsFixture>
+ test.beforeAll(() => {
+ fixtures = readRemainingFixture(input, run).fixtures as Record<string, GfsFixture>
+ })
+
+ for (const binding of run.bindings) {
+ test(`${binding.provider} Files preview and attached GFS image preserve source and ordered pixels`, async ({
+ appPage,
+ }, testInfo) => {
+ const fixture = fixtures[binding.provider]!
+ const codes = await Promise.all(fixture.files.map(file => preparedPixelCode(run, file)))
+ expect(new Set(codes).size).toBe(2)
+ for (const code of codes) {
+ expect(
+ JSON.stringify(
+ fixture.files.map(({ name, drive, resourceId, version, gfsUri }) => ({
+ name,
+ drive,
+ resourceId,
+ version,
+ gfsUri,
+ }))
+ )
+ ).not.toContain(code)
+ }
+ await test.step('open both prepared images through Files and decode the visible preview', async () => {
+ for (const [index, file] of fixture.files.entries()) {
+ await openResourcesNavItem(appPage, 'nav-files')
+ const browser = appPage.getByRole('region', { name: 'EvenDrive browser', exact: true })
+ await expect(browser).toBeVisible()
+ const root = browser
+ .getByRole('navigation', { name: 'File location', exact: true })
+ .getByRole('button', { name: 'Shared with me', exact: true })
+ // A read-only snapshot chooses the current breadcrumb state; visible assertions retry.
+ if (await root.isEnabled()) await root.click()
+ for (const folder of fixture.folderNames) {
+ const entry = browser.getByRole('button', { name: `Open ${folder}`, exact: true })
+ await expect(entry).toBeVisible()
+ await entry.click()
+ await expect(
+ browser.getByRole('navigation', { name: 'File location', exact: true })
+ ).toContainText(folder)
+ }
+ const entry = browser.getByRole('button', { name: `Open ${file.name}`, exact: true })
+ await expect(entry).toBeVisible()
+ await entry.click()
+ await expect(
+ appPage.getByRole('heading', { name: file.name, level: 2, exact: true })
+ ).toBeVisible()
+ const preview = appPage.getByRole('img', { name: `Preview of ${file.name}`, exact: true })
+ await expect(preview).toBeVisible()
+ await expect
+ .poll(() =>
+ preview.evaluate(async element => {
+ const image = element as HTMLImageElement
+ try {
+ await image.decode()
+ return { width: image.naturalWidth, height: image.naturalHeight }
+ } catch {
+ return null
+ }
+ })
+ )
+ .toEqual({ width: file.width, height: file.height })
+ if (run.mode === 'fixture') {
+ // Read only the image already displayed by the real preview. This
+ // detects a stale/wrong source behind a correct filename and size.
+ const displayedPixels = await preview.evaluate(element => {
+ const image = element as HTMLImageElement
+ const canvas = document.createElement('canvas')
+ canvas.width = image.naturalWidth
+ canvas.height = image.naturalHeight
+ const context = canvas.getContext('2d')
+ if (!context) throw new Error('Visible preview pixels cannot be read')
+ context.drawImage(image, 0, 0)
+ return canvas.toDataURL('image/png').split(',')[1]!
+ })
+ expect(await decodeTileChallenge(Buffer.from(displayedPixels, 'base64'))).toBe(
+ codes[index]
+ )
+ }
+ }
+ })
+ await openOwnedChat(appPage, binding)
+ await test.step('choose the same GFS files visibly in their intended message order', async () => {
+ await appPage.getByRole('button', { name: 'Add context', exact: true }).click()
+ const evenDrive = appPage.getByRole('menuitem', { name: 'EvenDrive', exact: true })
+ await expect(evenDrive).toBeVisible()
+ await evenDrive.click()
+ const picker = appPage.getByRole('dialog', {
+ name: 'Choose files for this message',
+ exact: true,
+ })
+ await expect(picker).toBeVisible()
+ for (const folder of fixture.folderNames) {
- const directory = picker
- .getByRole('button')
- .filter({
- hasText: new RegExp(`^${folder.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*Folder$`),
- })
++ const directory = picker.getByRole('button').filter({
++ hasText: new RegExp(`^${folder.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*Folder$`),
++ })
+ await expect(directory).toBeVisible()
+ await directory.click()
+ await expect(
+ picker.getByRole('navigation', { name: 'Global file path', exact: true })
+ ).toContainText(folder)
+ }
+ for (const file of fixture.files) {
+ const checkbox = picker.getByRole('checkbox', {
+ name: new RegExp(`^${file.name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s`),
+ })
+ await expect(checkbox).toBeVisible()
+ await checkbox.check()
+ await expect(checkbox).toBeChecked()
+ }
+ await picker.getByRole('button', { name: 'Attach 2', exact: true }).click()
+ await expect(picker).toHaveCount(0)
+ for (const file of fixture.files)
+ await expect(
+ appPage.getByRole('button', { name: `Remove ${file.name}`, exact: true })
+ ).toBeVisible()
+ const labels = await appPage.locator('.composer-attachment-chip strong').allTextContents()
+ expect(labels).toEqual(fixture.files.map(file => file.name))
+ })
+ const receiptId = randomUUID()
+ const targets = fixture.files.map(({ drive, resourceId, version }) => ({
+ drive,
+ resourceId,
+ version,
+ }))
+ const prompt = [
+ 'Journey: gfs-image',
+ `GFS targets: ${JSON.stringify(targets)}`,
+ 'Use clerum__gfs_read for each attached image in this order, with the exact expectedVersion shown above.',
+ 'Read the hexadecimal challenge from the returned image pixels. Reply only with one code per line in file order.',
+ 'Do not infer pixels from file names or source metadata. Do not use OCR or other tools.',
+ `Receipt: ${receiptId}`,
+ ].join('\n')
+ for (const code of codes) expect(prompt).not.toContain(code)
+ await submitVisibly(appPage, binding, prompt)
+ for (const file of fixture.files)
+ await expect(
+ appPage.getByTestId('message-list').getByText(file.name, { exact: true })
+ ).toBeVisible()
+ const expected = outputPattern(codes)
+ await settledVisibleAnswer(appPage, binding, expected)
+ await showCompletedTools(appPage, ['gfs_read', 'gfs_read'])
+ const turn = await observeDurableTurn(appPage, binding, {
+ status: 'completed',
+ response: expected,
+ })
+ expect(turn.userAttachments).toEqual(
+ fixture.files.map(file => ({
+ id: `global-file:${file.drive}:${file.pickerResourceId}`,
+ type: 'global_file',
+ label: file.name,
+ }))
+ )
+ expect(turn.toolSteps).toEqual([
+ { toolName: 'clerum__gfs_read', state: 'completed' },
+ { toolName: 'clerum__gfs_read', state: 'completed' },
+ ])
+ await assertPixelVendorEvidence(
+ run,
+ binding,
+ receiptId,
+ {
+ journey: 'gfs-image',
+ stages: ['read', 'pixels'],
+ imageSha256: fixture.files.map(file => file.imageSha256),
+ mimeTypes: fixture.files.map(file => file.mimeType),
+ output: codes.join('\n'),
+ calls: fixture.files.map(file => ({
+ name: 'clerum__gfs_read',
+ argumentsSha256: sha256(
+ JSON.stringify({
+ drive: file.drive,
+ resourceId: file.resourceId,
+ expectedVersion: file.version,
+ })
+ ),
+ })),
+ sources: fixture.files.map(({ drive, resourceId, version, gfsUri }) => ({
+ kind: 'gfs',
+ drive,
+ resourceId,
+ version,
+ gfsUri,
+ })),
+ referencedFiles: fixture.files.map(({ drive, resourceId, version, sizeBytes }) => ({
+ referenceId: `gfs:${drive}:${resourceId}@v${version}`,
+ drive,
+ resourceId,
+ version,
+ availability: 'available',
+ byteLength: sizeBytes,
+ })),
+ },
+ turn,
+ testInfo
+ )
+ await testInfo.attach('gfs-image-source-identity', {
+ contentType: 'application/json',
+ body: Buffer.from(
+ JSON.stringify({
+ runId: run.runId,
+ hostRef: fixture.hostRef,
+ podUid: fixture.podUid,
+ imageId: fixture.imageId,
+ taskId: turn.taskId,
+ files: fixture.files.map(
+ ({ drive, resourceId, gfsUri, version, sizeBytes, imageSha256 }) => ({
+ drive,
+ resourceId,
+ gfsUri,
+ version,
+ sizeBytes,
+ imageSha256,
+ })
+ ),
+ })
+ ),
+ })
+ })
+ }
diff --cc desktop-app/ui/src/components/agents/ComposerPanel.tsx
index 5f022a941,d594f05f0..5160ee069
--- a/desktop-app/ui/src/components/agents/ComposerPanel.tsx
+++ b/desktop-app/ui/src/components/agents/ComposerPanel.tsx
@@@ -21,9 -21,11 +21,11 @@@ import
} from '@constants/agentFeatures'
import {
COMPOSER_ACCEPT_IMAGE_MIME_TYPES,
- COMPOSER_MAX_IMAGE_ATTACHMENTS,
+ COMPOSER_MAX_ATTACHMENTS,
+ type ComposerImageBudget,
+ type ComposerImageTotalBudget,
composerImageBudget,
- composerImageBudgetBytes,
+ composerImageCountedBytes,
} from '@constants/attachments'
import { useContextsDataController } from '@hooks/domain/useContextsDataController'
import { useMcpServersDataController } from '@hooks/domain/useMcpServersDataController'
@@@ -577,26 -560,16 +588,15 @@@ export function ComposerPanel({ inline
} not added.`
)
}
- // Non-Codex images keep the #669 base64 ceiling; Codex images are held
- // to the decoded image quota rpc-proxy and mcp-host enforce (#650).
- const totalMeasure = imageBudget.maxTotal.measure
- // This callback runs under `void`, so a throw here would be an unhandled
- // rejection the user never sees. An attached image that cannot be
- // measured (a chip restored with malformed base64) refuses the whole
- // gesture with a visible notice: the remaining quota is unknown.
- let totalImageBytes = 0
- for (const attachment of composerImageAttachments) {
- try {
- totalImageBytes += composerImageBudgetBytes(attachment.dataBase64, totalMeasure)
- } catch (error) {
- setComposerAttachmentError(
- `${attachment.name || 'Image'} could not be measured against the image limit (${
- error instanceof Error ? error.message : String(error)
- }). Remove it and attach it again.`
- // General images travel inline in one 10 MB body, counted in base64
- // characters (#669). Grok counts decoded bytes against the 16 MiB ingress
- // total (#784). Codex leaves the aggregate to the hop (#650).
++ // General images are counted in base64 characters (#669). Codex and Grok
++ // count decoded bytes against the 16 MiB ingress total (#650, #784).
+ const totalBudget = imageBudget.total
+ let totalCountedBytes = totalBudget
+ ? composerImageAttachments.reduce(
+ (total, attachment) => total + composerImageCountedBytes(totalBudget, attachment),
+ 0
)
- return
- }
- }
+ : 0
for (const [index, { file, mimeType }] of selected.entries()) {
if (composerImageExceedsPerImageBudget(file.size, imageBudget.maxImageBytes)) {
diff --cc desktop-app/ui/src/components/agents/__tests__/ComposerPanel.test.tsx
index f7a1b71e0,95fecec8b..e85c5f97a
--- a/desktop-app/ui/src/components/agents/__tests__/ComposerPanel.test.tsx
+++ b/desktop-app/ui/src/components/agents/__tests__/ComposerPanel.test.tsx
@@@ -7,12 -7,12 +7,13 @@@ import { resolve } from 'node:path
import {
CODEX_COMPOSER_MAX_IMAGE_BYTES,
CODEX_COMPOSER_MAX_IMAGE_DIMENSION,
- COMPOSER_MAX_IMAGE_ATTACHMENTS,
+ COMPOSER_MAX_ATTACHMENTS,
COMPOSER_MAX_IMAGE_BYTES,
COMPOSER_MAX_TOTAL_IMAGE_BASE64_BYTES,
+ GROK_COMPOSER_MAX_IMAGE_BYTES,
} from '@constants/attachments'
import type { HostModelsResult } from '@hooks/useChatStore'
+import { readComposerFile } from '@lib/composerFileAdmission'
import {
type ImageInputDecision,
imageInputBlockMessage,
@@@ -982,50 -871,11 +983,28 @@@ describe('ComposerPanel Codex image bud
await waitFor(() =>
expect(actionsMock.handleAddComposerImageAttachments).toHaveBeenCalledTimes(1)
)
- expect(addedBatches()[0]?.map(attachment => attachment.name)).toEqual([
- 'fits.png',
- 'over-total.png',
- ])
- expect(screen.queryByRole('alert')).toBeNull()
+ expect(expectSinglePreparedImage().name).toBe('next.png')
+ })
+
- it('refuses a new image with a visible error when an attached image holds malformed base64', async () => {
- // A chip restored from a failed send keeps the stored base64 as it is; one
- // whose length is not a multiple of four cannot be measured in decoded bytes.
- const restored = attachedImage('restored', 'restored.png', 8)
- composerState.composerImageAttachments = [
- { ...restored, dataBase64: restored.dataBase64.slice(0, -1) },
- ]
- const { container } = render(<ComposerPanel inline />)
-
- fireEvent.change(pickerInput(container), {
- target: { files: [pngOfSize('next.png', 64, 1)] },
- })
-
- // Liveness witness: the refusal reached the user and names the chip at fault.
- await waitFor(() =>
- expect(screen.queryByRole('alert')?.textContent).toBe(
- 'restored.png could not be measured against the image limit (Image data is not canonical base64.). Remove it and attach it again.'
- )
- )
- expect(actionsMock.handleAddComposerImageAttachments).not.toHaveBeenCalled()
- })
-
+ it('refuses an annotation save that would push the decoded images past 16 MiB', () => {
+ const already = attachedImage('already', 'already.png', 8 * MIB)
+ const editing = attachedImage('editing', 'edit.png', 8 * MIB - 3)
+ composerState.composerImageAttachments = [already, editing]
+ render(<ComposerPanel inline />)
+ fireEvent.click(screen.getByText('edit.png'))
+ expect(annotationCanvasMock.onSave).toEqual(expect.any(Function))
+
+ expect(() =>
+ annotationCanvasMock.onSave?.({ ...attachedImage('editing', 'edit.png', 8 * MIB + 1) })
+ ).toThrow(
+ 'edit.png was kept unchanged. The images in one message are limited to 16 MiB in total.'
+ )
+ expect(actionsMock.handleUpdateComposerImageAttachment).not.toHaveBeenCalled()
+
+ // Twin: a save that fills the quota exactly replaces the attachment.
+ const fits = attachedImage('editing', 'edit.png', 8 * MIB)
+ annotationCanvasMock.onSave?.(fits)
+ expect(actionsMock.handleUpdateComposerImageAttachment).toHaveBeenCalledWith(fits)
})
})
diff --cc desktop-app/ui/src/constants/__tests__/attachments.test.ts
index 286a53e38,dd05837f1..94dda794e
--- a/desktop-app/ui/src/constants/__tests__/attachments.test.ts
+++ b/desktop-app/ui/src/constants/__tests__/attachments.test.ts
@@@ -1,23 -1,82 +1,88 @@@
import { describe, expect, it } from 'vitest'
- import { composerImageBudgetBytes } from '../attachments'
+ import {
+ CODEX_COMPOSER_MAX_IMAGE_BYTES,
+ CODEX_COMPOSER_MAX_IMAGE_DIMENSION,
++ CODEX_COMPOSER_MAX_TOTAL_IMAGE_DECODED_BYTES,
+ COMPOSER_MAX_IMAGE_BYTES,
+ COMPOSER_MAX_TOTAL_IMAGE_BASE64_BYTES,
+ composerImageBudget,
+ composerImageCountedBytes,
+ } from '../attachments'
- describe('composerImageBudgetBytes', () => {
- it('counts the decoded bytes of canonical base64 the way rpc-proxy and mcp-host do', () => {
- // The PNG signature: 12 characters with one `=` decode to 8 bytes.
- const signature = 'iVBORw0KGgo='
- expect(composerImageBudgetBytes(signature, 'decoded')).toBe(8)
- expect(composerImageBudgetBytes(signature, 'decoded')).toBe(atob(signature).length)
- expect(composerImageBudgetBytes('AA==', 'decoded')).toBe(1)
- expect(composerImageBudgetBytes('AAAA', 'decoded')).toBe(3)
+ const MIB = 1024 * 1024
+
+ describe('composerImageBudget', () => {
+ it('gives grok-subscription the shared ingress cap with no dimension bound (#784)', () => {
+ const budget = composerImageBudget('grok-subscription')
+ expect(budget).toEqual({
+ maxImageBytes: 16777216,
+ total: {
+ counts: 'decoded',
+ maxBytes: 16777216,
+ labelBytes: 16777216,
+ },
+ maxDimension: null,
+ sizeUnit: 'MiB',
+ })
+ // The total is the decoded 16 MiB that rpc-proxy and mcp-host accept for
+ // one message, not the 20 MiB xAI allows per image. The composer sums the
+ // decoded `sizeBytes` of each image, so the check matches the ingress to
+ // the byte.
+ expect(budget.maxImageBytes).toBe(16 * MIB)
+ expect(budget.total?.maxBytes).toBe(16 * MIB)
+ expect(budget.total?.labelBytes).toBe(16 * MIB)
+ expect(15 * MIB).toBeLessThanOrEqual(budget.maxImageBytes)
+ expect(17 * MIB).toBeGreaterThan(budget.maxImageBytes)
+ })
+
- it('keeps the Codex budget unchanged', () => {
++ it('holds Codex to the decoded 16 MiB image total that rpc-proxy and mcp-host enforce', () => {
+ expect(composerImageBudget('codex-subscription')).toEqual({
+ maxImageBytes: CODEX_COMPOSER_MAX_IMAGE_BYTES,
- total: null,
++ total: {
++ counts: 'decoded',
++ maxBytes: CODEX_COMPOSER_MAX_TOTAL_IMAGE_DECODED_BYTES,
++ labelBytes: CODEX_COMPOSER_MAX_TOTAL_IMAGE_DECODED_BYTES,
++ },
+ maxDimension: CODEX_COMPOSER_MAX_IMAGE_DIMENSION,
+ sizeUnit: 'MiB',
+ })
+ expect(CODEX_COMPOSER_MAX_IMAGE_BYTES).toBe(16 * MIB)
++ expect(CODEX_COMPOSER_MAX_TOTAL_IMAGE_DECODED_BYTES).toBe(16 * MIB)
+ expect(CODEX_COMPOSER_MAX_IMAGE_DIMENSION).toBe(2048)
})
- it('refuses base64 whose length is not a multiple of four instead of measuring it', () => {
- // Witness: the canonical value of the same bytes is measured.
- expect(composerImageBudgetBytes('iVBORw0KGgo=', 'decoded')).toBe(8)
- for (const malformed of ['iVBORw0KGgo', 'iVBORw0KGgo==', 'A', 'AAAAA']) {
- expect(() => composerImageBudgetBytes(malformed, 'decoded'), malformed).toThrow(
- 'Image data is not canonical base64.'
- )
+ it.each([undefined, null, 'anthropic', 'openai'])(
+ 'keeps the general budget for provider %s',
+ provider => {
+ expect(composerImageBudget(provider)).toEqual({
+ maxImageBytes: COMPOSER_MAX_IMAGE_BYTES,
+ total: {
+ counts: 'base64',
+ maxBytes: COMPOSER_MAX_TOTAL_IMAGE_BASE64_BYTES,
+ labelBytes: COMPOSER_MAX_TOTAL_IMAGE_BASE64_BYTES,
+ },
+ maxDimension: null,
+ sizeUnit: 'MB',
+ })
+ expect(COMPOSER_MAX_IMAGE_BYTES).toBe(3 * MIB)
+ expect(COMPOSER_MAX_TOTAL_IMAGE_BASE64_BYTES).toBe(8 * MIB)
}
+ )
+ })
+
+ describe('composerImageCountedBytes', () => {
+ // 5 base64 characters decode to 3 bytes or fewer, so the two units differ.
+ const attachment = { dataBase64: 'AAAAA', sizeBytes: 3 }
+
+ it('counts decoded bytes for a decoded total', () => {
+ const total = composerImageBudget('grok-subscription').total
+ expect(total).not.toBeNull()
+ expect(composerImageCountedBytes(total!, attachment)).toBe(3)
+ })
+
+ it('counts base64 characters for a base64 total', () => {
+ const total = composerImageBudget('anthropic').total
+ expect(total).not.toBeNull()
+ expect(composerImageCountedBytes(total!, attachment)).toBe(5)
})
})
diff --cc desktop-app/ui/src/constants/attachments.ts
index 708e55c33,bb0f653d7..4bf77dccf
--- a/desktop-app/ui/src/constants/attachments.ts
+++ b/desktop-app/ui/src/constants/attachments.ts
@@@ -76,25 -31,48 +83,53 @@@ export const GROK_COMPOSER_MAX_IMAGE_BY
export const COMPOSER_ACCEPT_IMAGE_MIME_TYPES = ['image/jpeg', 'image/png'] as const
export const CODEX_SUBSCRIPTION_PROVIDER = 'codex-subscription'
+ export const GROK_SUBSCRIPTION_PROVIDER = 'grok-subscription'
+
+ /**
+ * The composer aggregate one message must fit in. The general branch sums and
- * names base64 MB (#669). Grok sums the decoded bytes of each image, which is
- * what the shared 16 MiB ingress total counts (#784).
++ * names base64 MB (#669). Codex and Grok sum the decoded bytes of each image,
++ * which is what the shared 16 MiB ingress total counts (#650, #784).
+ */
+ export type ComposerImageTotalBudget = {
+ /** What the composer sums: base64 characters or decoded image bytes. */
+ counts: 'base64' | 'decoded'
+ /** Limit on that sum, in the unit named by `counts`. */
+ maxBytes: number
+ /** Bytes the total-limit copy names. */
+ labelBytes: number
+ }
+
+ /** Bytes one attachment adds to the sum the budget's `counts` names. */
+ export function composerImageCountedBytes(
+ total: ComposerImageTotalBudget,
+ attachment: { dataBase64: string; sizeBytes: number }
+ ): number {
+ return total.counts === 'base64' ? attachment.dataBase64.length : attachment.sizeBytes
+ }
export type ComposerImageBudget = {
maxImageBytes: number
- /**
- * Combined size of the images in one message, measured either as the length
- * of their base64 or as their decoded bytes.
- */
- maxTotal: { bytes: number; measure: 'base64' | 'decoded' }
- /** `null` → no composer pixel bound (general models). */
- /** `null` → no composer aggregate; the Codex hop owns that ceiling. */
++ /** `null` → no composer aggregate. */
+ total: ComposerImageTotalBudget | null
+ /** `null` → no composer pixel bound (Grok and general models). */
maxDimension: number | null
sizeUnit: 'MB' | 'MiB'
}
- /** Product limits for the picker. Codex keeps #650; everyone else keeps #669. */
+ /**
- * Product limits for the picker. Codex keeps #650, Grok gets the shared
- * ingress cap with no pixel bound (#784), everyone else keeps #669.
++ * Product limits for the picker. Codex keeps #650 and the decoded ingress
++ * total, Grok gets the shared ingress cap with no pixel bound (#784), everyone
++ * else keeps #669.
+ */
export function composerImageBudget(provider: string | null | undefined): ComposerImageBudget {
if (provider === CODEX_SUBSCRIPTION_PROVIDER) {
return {
maxImageBytes: CODEX_COMPOSER_MAX_IMAGE_BYTES,
- maxTotal: { bytes: CODEX_COMPOSER_MAX_TOTAL_IMAGE_DECODED_BYTES, measure: 'decoded' },
- total: null,
++ total: {
++ counts: 'decoded',
++ maxBytes: CODEX_COMPOSER_MAX_TOTAL_IMAGE_DECODED_BYTES,
++ labelBytes: CODEX_COMPOSER_MAX_TOTAL_IMAGE_DECODED_BYTES,
++ },
maxDimension: CODEX_COMPOSER_MAX_IMAGE_DIMENSION,
sizeUnit: 'MiB',
}
diff --cc external-rest-api/src/releaseManifest.ts
index 2ad1eee29,97396ccf6..6a7483711
--- a/external-rest-api/src/releaseManifest.ts
+++ b/external-rest-api/src/releaseManifest.ts
@@@ -8,8 -8,8 +8,8 @@@ export type ReleaseManifest =
export const releaseManifest: ReleaseManifest = {
releaseId: 'v0.10.0',
- externalRestApiVersion: '0.1.96',
- rpcProxyVersion: '0.1.125',
+ externalRestApiVersion: '0.1.97',
- rpcProxyVersion: '0.1.120',
++ rpcProxyVersion: '0.1.126',
desktopVersion: '0.10.0',
minimumDesktopVersion: '0.1.252',
}
diff --cc mcp-host/package-lock.json
index 1d5ffdcd0,0d8680d47..6baf4becf
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@@ -1,12 -1,12 +1,12 @@@
{
"name": "clerum-mcp-host",
- "version": "0.1.509",
- "version": "0.1.500",
++ "version": "0.1.510",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.509",
- "version": "0.1.500",
++ "version": "0.1.510",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --cc mcp-host/package.json
index 705096994,07d66f086..3fca8f975
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "clerum-mcp-host",
- "version": "0.1.509",
- "version": "0.1.500",
++ "version": "0.1.510",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --cc rpc-proxy/package-lock.json
index afc66b45e,173582f76..5fe41f9e4
--- a/rpc-proxy/package-lock.json
+++ b/rpc-proxy/package-lock.json
@@@ -1,12 -1,12 +1,12 @@@
{
"name": "clerum-rpc-proxy",
- "version": "0.1.125",
- "version": "0.1.120",
++ "version": "0.1.126",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-rpc-proxy",
- "version": "0.1.125",
- "version": "0.1.120",
++ "version": "0.1.126",
"dependencies": {
"@clerum/jwt-key-policy": "file:../packages/jwt-key-policy",
"cors": "^2.8.5",
diff --cc rpc-proxy/package.json
index 3357ffac5,cd84dce4f..886e22f60
--- a/rpc-proxy/package.json
+++ b/rpc-proxy/package.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "clerum-rpc-proxy",
- "version": "0.1.125",
- "version": "0.1.120",
++ "version": "0.1.126",
"description": "External-facing RPC proxy for tenant-scoped MCP access",
"main": "dist/main.js",
"engines": {
diff --cc tests/e2e/fixtures/package-lock.json
index c400c415d,2e21df64b..4eb94638c
--- a/tests/e2e/fixtures/package-lock.json
+++ b/tests/e2e/fixtures/package-lock.json
@@@ -1,12 -1,12 +1,12 @@@
{
"name": "@clerum/e2e-test-fixtures",
- "version": "1.0.105",
- "version": "1.0.101",
++ "version": "1.0.106",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@clerum/e2e-test-fixtures",
- "version": "1.0.105",
- "version": "1.0.101",
++ "version": "1.0.106",
"dependencies": {
"@kubernetes/client-node": "^1.0.0"
},
diff --cc tests/e2e/fixtures/package.json
index 1f3b95d8d,0523a0d75..0db64e77c
--- a/tests/e2e/fixtures/package.json
+++ b/tests/e2e/fixtures/package.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "@clerum/e2e-test-fixtures",
- "version": "1.0.105",
- "version": "1.0.101",
++ "version": "1.0.106",
"description": "E2E test fixtures and utilities for Clerum testing",
"type": "module",
"main": "index.ts",
diff --cc tests/e2e/integration/chat-body-budget-parity.test.ts
index ac32f1c77,000000000..94c83da8d
mode 100644,000000..100644
--- a/tests/e2e/integration/chat-body-budget-parity.test.ts
+++ b/tests/e2e/integration/chat-body-budget-parity.test.ts
@@@ -1,319 -1,0 +1,326 @@@
+/**
+ * Parity gate for the chat request body budget (#678).
+ *
+ * rpc-proxy and mcp-host each parse the chat body with their own copy of the
+ * budget (no shared package exists), and the Desktop composer mirrors the same
+ * numbers to refuse an attachment before it is sent. A drift between any two
+ * of them either lets the composer build a request a server rejects, or lets
+ * one hop accept what the next refuses. This suite reads the sources and fails
+ * when a limit or a qualification predicate differs.
+ *
+ * Every lookup must match exactly once: a renamed or duplicated constant fails
+ * here instead of turning a comparison into one between two `undefined`s.
+ */
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { dirname, join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+
+const here = dirname(fileURLToPath(import.meta.url))
+const repoRoot = join(here, '../../..')
+
+const MIB = 1024 * 1024
+
+const sources = {
+ rpcProxy: readFileSync(join(repoRoot, 'rpc-proxy/src/middleware/chatJsonBody.ts'), 'utf8'),
+ mcpHost: readFileSync(join(repoRoot, 'mcp-host/src/server.ts'), 'utf8'),
+ composer: readFileSync(join(repoRoot, 'desktop-app/ui/src/constants/attachments.ts'), 'utf8'),
+ composerAdmission: readFileSync(
+ join(repoRoot, 'desktop-app/ui/src/lib/composerFileAdmission.ts'),
+ 'utf8'
+ ),
+ hostConfig: readFileSync(join(repoRoot, 'mcp-host/src/config.ts'), 'utf8'),
+ hostAdmission: readFileSync(join(repoRoot, 'mcp-host/src/agent/incomingAttachments.ts'), 'utf8'),
+ rpcProxyForwardingTest: readFileSync(
+ join(repoRoot, 'rpc-proxy/src/__tests__/wake-and-hold-route.test.ts'),
+ 'utf8'
+ ),
+}
+
+function soleMatch(source: string, pattern: RegExp, label: string): RegExpMatchArray {
+ const flags = pattern.flags.includes('g') ? pattern.flags : `${pattern.flags}g`
+ const matches = [...source.matchAll(new RegExp(pattern.source, flags))]
+ expect(matches.length, `${label} must appear exactly once`).toBe(1)
+ return matches[0]
+}
+
+/** Value of `const NAME = 16 * 1024 * 1024` (or a plain integer literal). */
+function constantValue(source: string, name: string, label: string): number {
+ const [, expression] = soleMatch(
+ source,
+ new RegExp(`^(?:export )?const ${name} = ([0-9_]+(?: \\* [0-9_]+)*)$`, 'm'),
+ `${label} ${name}`
+ )
+ return expression
+ .split(' * ')
+ .map(factor => Number(factor.replaceAll('_', '')))
+ .reduce((product, factor) => product * factor, 1)
+}
+
+/**
+ * Source text of a top-level `function name(...) { ... }` (exported or not),
+ * closed by a column-0 `}`.
+ */
+function functionSource(source: string, name: string, label: string): string {
+ return soleMatch(
+ source,
+ new RegExp(`^(?:export )?function ${name}\\([\\s\\S]*?^\\}$`, 'm'),
+ `${label} ${name}`
+ )[0]
+}
+
+const SERVER_LIMITS: ReadonlyArray<readonly [string, number]> = [
+ ['MAX_CHAT_BODY_BYTES', 24 * MIB],
+ ['MAX_NON_IMAGE_BODY_BYTES', 6 * MIB],
+ ['MAX_CHAT_IMAGES', 20],
+ ['MAX_IMAGE_DECODED_BYTES', 16 * MIB],
+ ['MAX_IMAGE_DECODED_BYTES_TOTAL', 16 * MIB],
+ ['MAX_CHAT_FILES', 20],
+ ['MAX_FILE_DECODED_BYTES', 11 * MIB],
+ ['MAX_FILE_BASE64_BYTES_TOTAL', 16 * MIB],
+]
+
+/** Declarations both parsers must spell identically, with the value they must have. */
+const SERVER_DECLARATIONS: ReadonlyArray<readonly [string, string]> = [
+ ['BASE64_RE', '/^[A-Za-z0-9+/]+={0,2}$/'],
+ ['PNG_SIGNATURE', 'Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])'],
+ ['JPEG_SIGNATURE', 'Buffer.from([0xff, 0xd8, 0xff])'],
+]
+
+/** One trimmed source line of `functionText` that starts with `prefix`. */
+function soleLine(functionText: string, prefix: string, label: string): string {
+ const escaped = prefix.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+ return soleMatch(functionText, new RegExp(`^ *${escaped}.*$`, 'm'), label)[0].trim()
+}
+
+const BUDGET_FUNCTIONS = [
+ 'base64SextetValue',
+ 'decodedBase64Bytes',
+ 'inspectChatImageBudget',
+ 'inspectChatFileBudget',
+ 'chatBodyExceedsNonImageBudget',
+] as const
+
+describe('chat body budget parity across rpc-proxy, mcp-host and the composer (#678)', () => {
+ it.each(SERVER_LIMITS)('both parsers declare %s with the same value', (name, expected) => {
+ expect(constantValue(sources.rpcProxy, name, 'rpc-proxy')).toBe(expected)
+ expect(constantValue(sources.mcpHost, name, 'mcp-host')).toBe(expected)
+ })
+
+ it('both parsers require the same lowercase sha256 hex digest', () => {
+ const pattern = /^const SHA256_HEX_RE = (\/.+\/)$/m
+ const rpcProxy = soleMatch(sources.rpcProxy, pattern, 'rpc-proxy SHA256_HEX_RE')[1]
+ const mcpHost = soleMatch(sources.mcpHost, pattern, 'mcp-host SHA256_HEX_RE')[1]
+ expect(rpcProxy).toBe('/^[0-9a-f]{64}$/')
+ expect(mcpHost).toBe(rpcProxy)
+ })
+
+ it.each(SERVER_DECLARATIONS)('both parsers declare %s as the same value', (name, expected) => {
+ const pattern = new RegExp(`^const ${name} = (.+)$`, 'm')
+ const rpcProxy = soleMatch(sources.rpcProxy, pattern, `rpc-proxy ${name}`)[1]
+ const mcpHost = soleMatch(sources.mcpHost, pattern, `mcp-host ${name}`)[1]
+ expect(rpcProxy).toBe(expected)
+ expect(mcpHost).toBe(rpcProxy)
+ })
+
+ it.each(BUDGET_FUNCTIONS)('both parsers implement %s identically', name => {
+ const rpcProxy = functionSource(sources.rpcProxy, name, 'rpc-proxy')
+ const mcpHost = functionSource(sources.mcpHost, name, 'mcp-host')
+ // Witness: the extracted text is the function, not an empty or truncated match.
+ expect(rpcProxy.split('\n').length).toBeGreaterThan(3)
+ expect(mcpHost).toBe(rpcProxy)
+ })
+
+ it('credits a file by its decoded size, bounded by the per-file and total quotas', () => {
+ const inspect = functionSource(sources.rpcProxy, 'inspectChatFileBudget', 'rpc-proxy')
+ expect(soleLine(inspect, 'if (decoded === null', 'per-file credit condition')).toBe(
+ 'if (decoded === null || decoded <= 0 || decoded > MAX_FILE_DECODED_BYTES) continue'
+ )
+ expect(soleLine(inspect, 'if (counted >=', 'file quota condition')).toBe(
+ 'if (counted >= MAX_CHAT_FILES || credited + dataBase64.length > MAX_FILE_BASE64_BYTES_TOTAL) {'
+ )
+ expect(soleLine(inspect, '!SHA256_HEX_RE.test(', 'digest condition')).toBe(
+ '!SHA256_HEX_RE.test(digest.hex)'
+ )
+ const exceeds = functionSource(sources.rpcProxy, 'chatBodyExceedsNonImageBudget', 'rpc-proxy')
+ expect(soleLine(exceeds, 'return rawBodyBytes', 'non-image share condition')).toBe(
+ 'return rawBodyBytes - images.creditedBase64 - files.creditedBase64 > MAX_NON_IMAGE_BODY_BYTES'
+ )
+ })
+
+ it('the composer mirrors the server limits', () => {
+ const composer: ReadonlyArray<readonly [string, number]> = [
+ [
+ 'COMPOSER_MAX_REQUEST_BODY_BYTES',
+ constantValue(sources.rpcProxy, 'MAX_CHAT_BODY_BYTES', 'rpc-proxy'),
+ ],
+ [
+ 'COMPOSER_MAX_NON_IMAGE_BODY_BYTES',
+ constantValue(sources.rpcProxy, 'MAX_NON_IMAGE_BODY_BYTES', 'rpc-proxy'),
+ ],
+ [
+ 'COMPOSER_MAX_FILE_BYTES',
+ constantValue(sources.rpcProxy, 'MAX_FILE_DECODED_BYTES', 'rpc-proxy'),
+ ],
+ [
+ 'COMPOSER_MAX_TOTAL_FILE_BASE64_BYTES',
+ constantValue(sources.rpcProxy, 'MAX_FILE_BASE64_BYTES_TOTAL', 'rpc-proxy'),
+ ],
+ [
+ 'CODEX_COMPOSER_MAX_IMAGE_BYTES',
+ constantValue(sources.rpcProxy, 'MAX_IMAGE_DECODED_BYTES', 'rpc-proxy'),
+ ],
+ [
+ 'CODEX_COMPOSER_MAX_TOTAL_IMAGE_DECODED_BYTES',
+ constantValue(sources.rpcProxy, 'MAX_IMAGE_DECODED_BYTES_TOTAL', 'rpc-proxy'),
+ ],
+ // The composer counts images and files together, as the Host admission does;
+ // MAX_CHAT_FILES bounds only the credited files.
+ [
+ 'COMPOSER_MAX_ATTACHMENTS',
+ constantValue(sources.hostAdmission, 'INCOMING_ATTACHMENT_MAX_COUNT', 'mcp-host admission'),
+ ],
+ ]
+ for (const [name, serverValue] of composer) {
+ expect(constantValue(sources.composer, name, 'composer'), name).toBe(serverValue)
+ }
+ })
+
+ it('the composer counts the Codex image quota in decoded bytes, as both parsers do', () => {
+ const budget = functionSource(sources.composer, 'composerImageBudget', 'composer')
- expect(soleLine(budget, 'maxTotal: { bytes: CODEX_', 'composer Codex image total')).toBe(
- "maxTotal: { bytes: CODEX_COMPOSER_MAX_TOTAL_IMAGE_DECODED_BYTES, measure: 'decoded' },"
++ const codexBranch = soleMatch(
++ budget,
++ /if \(provider === CODEX_SUBSCRIPTION_PROVIDER\) \{[\s\S]*?\n {2}\}/,
++ 'composer Codex branch'
++ )[0]
++ expect(soleLine(codexBranch, 'counts: ', 'composer Codex total unit')).toBe(
++ "counts: 'decoded',"
++ )
++ expect(soleLine(codexBranch, 'maxBytes: ', 'composer Codex total limit')).toBe(
++ 'maxBytes: CODEX_COMPOSER_MAX_TOTAL_IMAGE_DECODED_BYTES,'
++ )
++ // A decoded total sums each image's decoded size, which the composer holds as
++ // `sizeBytes` (the bytes it read from the file) and both parsers recompute
++ // from the base64 they receive.
++ const counted = functionSource(sources.composer, 'composerImageCountedBytes', 'composer')
++ expect(soleLine(counted, 'return ', 'composer counted bytes')).toBe(
++ "return total.counts === 'base64' ? attachment.dataBase64.length : attachment.sizeBytes"
+ )
- const composerDecoded = functionSource(sources.composer, 'composerImageBudgetBytes', 'composer')
- const serverDecoded = functionSource(sources.rpcProxy, 'decodedBase64Bytes', 'rpc-proxy')
- // The decoded size is the same arithmetic on the same base64 on both sides.
- for (const prefix of ['const padding = ', 'return (dataBase64.length / 4) * 3']) {
- expect(soleLine(composerDecoded, prefix, `composer ${prefix}`)).toBe(
- soleLine(serverDecoded, prefix, `rpc-proxy ${prefix}`)
- )
- }
+ // Both refuse only above the quota: a set that fills it exactly is admitted.
+ const inspect = functionSource(sources.rpcProxy, 'inspectChatImageBudget', 'rpc-proxy')
+ expect(soleLine(inspect, 'if (counted >=', 'image quota condition')).toBe(
+ 'if (counted >= MAX_CHAT_IMAGES || decodedTotal + decoded > MAX_IMAGE_DECODED_BYTES_TOTAL) {'
+ )
+ })
+
+ it('the composer estimates the non-image share and the file quota from these constants', () => {
+ // The estimate constants have no server counterpart: they bound the JSON
+ // around the text and the attachments. Pin them and every place the
+ // estimate uses them, so a changed literal or a dropped term fails here.
+ expect(constantValue(sources.composer, 'COMPOSER_REQUEST_ENVELOPE_BYTES', 'composer')).toBe(
+ 4096
+ )
+ expect(constantValue(sources.composer, 'COMPOSER_FILE_ENTRY_METADATA_BYTES', 'composer')).toBe(
+ 640
+ )
+ const admission = sources.composerAdmission
+ const lines: ReadonlyArray<readonly [string, string, string]> = [
+ ['jsonBytes', 'return ', 'return textEncoder.encode(JSON.stringify(value)).length'],
+ ['base64Length', 'return ', 'return Math.ceil(sizeBytes / 3) * 4'],
+ [
+ 'composerFileDetailBytes',
+ 'return ',
+ 'return jsonBytes(file.filename) + COMPOSER_FILE_ENTRY_METADATA_BYTES',
+ ],
+ [
+ 'composerFileBase64Bytes',
+ 'return ',
+ 'return files.reduce((total, file) => total + base64Length(file.sizeBytes), 0)',
+ ],
+ [
+ 'composerNonImageShareBytes',
+ 'COMPOSER_REQUEST_ENVELOPE_BYTES',
+ 'COMPOSER_REQUEST_ENVELOPE_BYTES +',
+ ],
+ [
+ 'composerNonImageShareBytes',
+ 'COMPOSER_FORWARDED_FIELDS_BYTES',
+ 'COMPOSER_FORWARDED_FIELDS_BYTES +',
+ ],
+ ['composerNonImageShareBytes', 'jsonBytes(request.content)', 'jsonBytes(request.content) +'],
+ [
+ 'composerNonImageShareBytes',
+ '(request.fileReferences.length',
+ '(request.fileReferences.length ? jsonBytes(request.fileReferences) : 0) +',
+ ],
+ [
+ 'composerNonImageShareBytes',
+ '2 * jsonBytes(request.hostRef)',
+ '2 * jsonBytes(request.hostRef) +',
+ ],
+ [
+ 'composerNonImageShareBytes',
+ 'request.files.reduce(',
+ 'request.files.reduce((total, file) => total + composerFileDetailBytes(file), 0) +',
+ ],
+ [
+ 'composerNonImageShareBytes',
+ '(total, image) =>',
+ '(total, image) => total + jsonBytes(image.name) + COMPOSER_FILE_ENTRY_METADATA_BYTES,',
+ ],
+ [
+ 'composerFileAdmissionError',
+ 'if (file.size >',
+ 'if (file.size > COMPOSER_MAX_FILE_BYTES) {',
+ ],
+ [
+ 'composerFileAdmissionError',
+ 'if (context.attachedCount',
+ 'if (context.attachedCount >= COMPOSER_MAX_ATTACHMENTS) {',
+ ],
+ [
+ 'composerFileAdmissionError',
+ 'if (composerFileBase64Bytes(',
+ 'if (composerFileBase64Bytes(files) > COMPOSER_MAX_TOTAL_FILE_BASE64_BYTES) {',
+ ],
+ [
+ 'composerFileAdmissionError',
+ 'const bodyBytes =',
+ 'const bodyBytes = composerNonImageShareBytes({ ...context.request, files })',
+ ],
+ [
+ 'composerFileAdmissionError',
+ 'if (bodyBytes >',
+ 'if (bodyBytes > COMPOSER_MAX_NON_IMAGE_BODY_BYTES) {',
+ ],
+ ]
+ for (const [name, prefix, expected] of lines) {
+ const body = functionSource(admission, name, 'composer admission')
+ expect(soleLine(body, prefix, `composer admission ${name} ${prefix}`)).toBe(expected)
+ }
+ // The non-image share is the sum of exactly the terms pinned above.
+ const share = functionSource(admission, 'composerNonImageShareBytes', 'composer admission')
+ expect(share.match(/ \+$/gm), 'composerNonImageShareBytes term count').toHaveLength(6)
+ })
+
+ it('the composer reserves the headroom rpc-proxy is tested to add when forwarding', () => {
+ expect(constantValue(sources.composer, 'COMPOSER_FORWARDED_FIELDS_BYTES', 'composer')).toBe(
+ constantValue(
+ sources.rpcProxyForwardingTest,
+ 'DESKTOP_FORWARDED_FIELDS_HEADROOM_BYTES',
+ 'rpc-proxy forwarding test'
+ )
+ )
+ })
+
+ it('the Host admission default and configured maximum equal the per-file credit ceiling', () => {
+ const [, literal, maximum] = soleMatch(
+ sources.hostConfig,
+ /getExecutionLimit\(\s*'CLERUM_ATTACHMENT_FILE_MAX_BYTES',\s*([0-9_]+),\s*false,\s*([0-9_]+)\s*\)/,
+ 'mcp-host config CLERUM_ATTACHMENT_FILE_MAX_BYTES bounds'
+ )
+ const ceiling = constantValue(sources.mcpHost, 'MAX_FILE_DECODED_BYTES', 'mcp-host')
+ expect(Number(literal.replaceAll('_', ''))).toBe(ceiling)
+ expect(Number(maximum.replaceAll('_', ''))).toBe(ceiling)
+ })
+})
diff --cc tests/e2e/package-lock.json
index da7288544,8a4555cd5..d1d65bd31
--- a/tests/e2e/package-lock.json
+++ b/tests/e2e/package-lock.json
@@@ -1,12 -1,12 +1,12 @@@
{
"name": "clerum-e2e-tests",
- "version": "0.1.101",
- "version": "0.1.102",
++ "version": "0.1.103",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-e2e-tests",
- "version": "0.1.101",
- "version": "0.1.102",
++ "version": "0.1.103",
"devDependencies": {
"@clerum/llm-provider-attempt-contract": "file:../../packages/llm-provider-attempt-contract",
"@types/jsonwebtoken": "^9.0.10",
diff --cc tests/e2e/package.json
index 0c7ad7fa9,3d991ed53..21a6a94bd
--- a/tests/e2e/package.json
+++ b/tests/e2e/package.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "clerum-e2e-tests",
- "version": "0.1.101",
- "version": "0.1.102",
++ "version": "0.1.103",
"private": true,
"type": "module",
"scripts": {