Skip to content

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

TypeScript

Merge origin/dev into feat/grok-subscription-image-input

Alfredo Lopez0c084c35eb4c
diff --cc control-api/package-lock.json
index f91636e53,7d6bad938..def1061e8
--- 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.724",
- "version": "0.1.711",
++ "version": "0.1.725",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.724",
- "version": "0.1.711",
++ "version": "0.1.725",
"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 50219ce5d,0882b95ab..80a38aff5
--- a/control-api/package.json
+++ b/control-api/package.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "clerum-control-api",
- "version": "0.1.724",
- "version": "0.1.711",
++ "version": "0.1.725",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --cc mcp-host/package-lock.json
index 9a07b3343,92694a93a..0d8680d47
--- 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.492",
- "version": "0.1.499",
++ "version": "0.1.500",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.492",
- "version": "0.1.499",
++ "version": "0.1.500",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --cc mcp-host/package.json
index 894f4eb5d,6c77eba38..07d66f086
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "clerum-mcp-host",
- "version": "0.1.492",
- "version": "0.1.499",
++ "version": "0.1.500",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --cc mcp-host/src/core/adapters/__tests__/llmImageCompatibility.test.ts
index 6a1320989,e041c7a37..8cc726a0c
--- a/mcp-host/src/core/adapters/__tests__/llmImageCompatibility.test.ts
+++ b/mcp-host/src/core/adapters/__tests__/llmImageCompatibility.test.ts
@@@ -24,11 -28,16 +28,18 @@@ import
} from '../../../llm/codexSubscription'
import { FailoverEngine } from '../../../llm/failover/engine'
import type { LlmPolicy } from '../../../llm/failover/types'
+import { type GrokSubscriptionDeps, GrokSubscriptionProvider } from '../../../llm/grokSubscription'
- import type { ImageInputResolver } from '../../../llm/imageInput'
+ import {
+ type ImageInputResolver,
+ type ImageTransportOperation,
+ transportSupportsImageInput,
+ } from '../../../llm/imageInput'
import { CodexAuthorizeError } from '../../../llm/providerAttemptAuthorizer'
+ import {
+ resolveOfficialVisualDeliveryLimits,
+ resolveVisualDeliveryLimits,
+ } from '../../../visualInput/deliveryLimits'
+import { TOOL_RESULT_IMAGE_TEXT } from '../../../visualInput/messageProjection'
- import { VISUAL_INPUT_LIMITS } from '../../../visualInput/policy'
import { LlmErrorCode } from '../../errors'
import { stripHistoricalMedia } from '../../extensions/prePrune'
import { appendToolResults } from '../../orchestration/toolUseLoopMessages'
@@@ -87,7 -96,15 +98,15 @@@ const TOOLS: ToolDefinition[] =
{ name: 'desktop_screenshot', description: 'Capture the desktop', parameters: {} },
]
-const EXPLANATORY_TEXT = 'Here are the screenshots from the tool results above.'
+const EXPLANATORY_TEXT = TOOL_RESULT_IMAGE_TEXT
+ const OPENAI_VISUAL_PROFILE = (operation: ImageTransportOperation) =>
+ resolveOfficialVisualDeliveryLimits('openai', 'https://api.openai.com/v1', operation)
+ const CLAUDE_VISUAL_PROFILE = (operation: ImageTransportOperation) =>
+ resolveOfficialVisualDeliveryLimits('claude', 'https://api.anthropic.com', operation)
+ const CODEX_VISUAL_PROFILE = (operation: ImageTransportOperation) =>
+ transportSupportsImageInput('codex-subscription', operation)
+ ? resolveVisualDeliveryLimits('codex-subscription')
+ : null
const imageAttachment = (
id: string,
diff --cc mcp-host/src/llm/__tests__/claude.singleTurn.test.ts
index c0300bf6d,048d29eca..9e885832e
--- a/mcp-host/src/llm/__tests__/claude.singleTurn.test.ts
+++ b/mcp-host/src/llm/__tests__/claude.singleTurn.test.ts
@@@ -1,8 -1,7 +1,8 @@@
import { describe, expect, it, vi } from 'vitest'
import { type ChatMessage, FinishReason } from '../../core/types'
+import { TOOL_RESULT_IMAGE_TEXT } from '../../visualInput/messageProjection'
- import { VISUAL_INPUT_LIMITS } from '../../visualInput/policy'
import { ClaudeProvider } from '../claude'
+ import { PNG_2X2_BASE64 } from './codexImageFixtures'
describe('Claude visual request limits', () => {
it.each([false, true])('bounds the final serialized request with cache=%s', async cache => {
diff --cc mcp-host/src/llm/codexSubscription.ts
index 1f47f724b,5c0f7151e..c46c02b9c
--- a/mcp-host/src/llm/codexSubscription.ts
+++ b/mcp-host/src/llm/codexSubscription.ts
@@@ -10,19 -10,19 +10,21 @@@ import
CompletionResponse,
ChatMessage as CoreChatMessage,
FinishReason,
- MessageContentImageSource,
- MessageContentPart,
ToolCompletionResponse,
ToolDefinition,
- textContentFromParts,
} from '../core/types'
import { logger } from '../logger'
+ import { resolveVisualDeliveryLimits } from '../visualInput/deliveryLimits'
+import {
+ attachmentBudgetRefusalMessageFor,
+ buildAttachmentBudgetRefusals,
+} from './attachmentBudgetRefusal'
import { CodexLlmProxyClient, CodexProxyError } from './codexLlmProxyClient'
import { classifyUnknown } from './errorClassification'
+ import { type ImageTransportOperation, transportSupportsImageInput } from './imageInput'
+import { IMAGE_SOURCE_INVALID, canonicalRefusalCode, projectMessage } from './imageSource'
import { CodexAuthorizeError, ProviderAttemptAuthorizer } from './providerAttemptAuthorizer'
-import { rateLimitRetryDelayMs, waitBeforeRetry } from './rateLimitRetry'
+import { authorizeRetryDelayMs, rateLimitRetryDelayMs, waitBeforeRetry } from './rateLimitRetry'
import { type LlmProvider, descriptorFor } from './registryCore'
import type { ClassifiedError, SingleTurnProvider } from './types'