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 Lopez28ff42ae3152
diff --cc mcp-host/package-lock.json
index d2bd708b7,0ad0982c9..7623f5d93
--- 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.513",
- "version": "0.1.506",
++ "version": "0.1.514",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.513",
- "version": "0.1.506",
++ "version": "0.1.514",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --cc mcp-host/package.json
index ef8b4ca87,3cb8a689f..33618b8df
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "clerum-mcp-host",
- "version": "0.1.513",
- "version": "0.1.506",
++ "version": "0.1.514",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --cc mcp-host/src/agent/taskExecutor.ts
index e9d971167,08d32ccb3..21ca8e84c
--- a/mcp-host/src/agent/taskExecutor.ts
+++ b/mcp-host/src/agent/taskExecutor.ts
@@@ -1612,16 -1561,7 +1619,16 @@@ export class TaskExecutor
}
}
- const { registry, loopController, bridge } = await this.buildToolRegistry()
+ const { registry, loopController, bridge, discoverableNatives } = await this.buildToolRegistry()
+ const applicableToolCounters = registry
+ .listDefinitions()
+ .some(tool => tool.name === 'clerum__attachment_read')
+ ? (effectiveLlmPort.getToolTokenCounters?.() ?? [tokenCounter])
+ : [tokenCounter]
+ const toolCounters = [...new Set(applicableToolCounters)]
+ await Promise.all(
+ toolCounters.filter(counter => counter !== tokenCounter).map(counter => counter.warmup())
+ )
// T2.2 — when the prompt-cache flag is ON and we have the dependencies
// wired (PromptCache + WorkspaceService), build the tiered
@@@ -1740,16 -1686,9 +1753,17 @@@
// oversized outputs and stamp `spillover_ref` on the result.
loopConfig.spilloverStorage = this.deps.spilloverStorage
loopConfig.taskId = this.taskId
+ // C15/C16 — the exact synchronous measurement the bounded native readers
+ // use for a result: the full tool message (framing + the larger applicable
+ // provider/BPE estimate), never a content-only shortcut.
+ // Page limits are enforced even when compaction is in tokenizer dry-run.
+ // Use the largest applicable synchronous estimate for every destination;
+ // emitted pages can survive a provider change in a later reasoning round.
+ loopConfig.measureToolMessage = message =>
+ Math.max(...toolCounters.map(counter => toolMessageBudgetTokens(message, counter, false)))
// F3 (dynamic-tool-loading): context the `clerum__tool_call` bridge intercept
- // needs in `executeToolCalls`. Undefined when no McpManager is wired.
+ // needs in `executeToolCalls`. Undefined when the registry registered no
+ // bridge tools (no MCP discovery with an McpManager, and native `direct`).
loopConfig.bridge = bridge
// P2 token budgets (§5.2): wire the per-task emergency brake when the P1
// verdict carried a per-task cap AND we captured a start-of-task baseline.
diff --cc mcp-host/src/config.ts
index b5ac75dff,d49f85a8a..0f6d16454
--- a/mcp-host/src/config.ts
+++ b/mcp-host/src/config.ts
@@@ -7,11 -7,13 +7,14 @@@ import type { GuardrailsConfig } from '
import { NativeToolConfig } from './core/interfaces'
import {
type CodexToolPresentation,
+ type NativeToolPresentation,
parseCodexToolDiscoveryBytes,
parseCodexToolPresentation,
+ parseNativeToolDiscoveryBytes,
+ parseNativeToolPresentation,
} from './core/orchestration/toolPresentationPolicy'
import { ALL_PROVIDERS, type LlmProvider, descriptorFor, isLlmProvider } from './llm/registryCore'
+import { logger } from './logger'
import type { McpCatalogBootstrapConfig } from './mcp/grantProbe'
import { HostSpec, McpServerInfo, MemoryConfig, ModelConfig, PersonalizationConfig } from './types'