feat(h5): add LLM intent router admin controls and shadow verification.

Expose shadow/canary router policy in ops admin, add FAQ rule fast-path,
and tighten router defaults (1200ms timeout, 0.65 confidence).
Includes verify-h5-llm-router-shadow for production canary rollout.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-01 16:48:01 +08:00
parent 005612029f
commit 43bc8bbc2b
14 changed files with 1391 additions and 80 deletions
+4 -1
View File
@@ -13,6 +13,8 @@ const FIELD_SPECS = [
{ env: 'MEMORY_FAIL_OPEN', group: 'global', field: 'failOpen', type: 'boolean' },
{ env: 'MEMIND_CHAT_LLM_ROUTER_ENABLED', group: 'chatIntentRouter', field: 'enabled', type: 'boolean' },
{ env: 'MEMIND_CHAT_LLM_ROUTER_SHADOW', group: 'chatIntentRouter', field: 'shadowMode', type: 'boolean' },
{ env: 'MEMIND_CHAT_ROUTER_CANARY_USER_IDS', group: 'chatIntentRouter', field: 'canaryUserIds', type: 'string' },
{ env: 'MEMIND_CHAT_ROUTER_MODEL_PROVIDER_KEY_ID', group: 'chatIntentRouter', field: 'modelProviderKeyId', type: 'string' },
{ env: 'MEMIND_CHAT_ROUTER_MODEL', group: 'chatIntentRouter', field: 'model', type: 'string' },
{ env: 'MEMIND_CHAT_ROUTER_MODEL_API', group: 'chatIntentRouter', field: 'modelApiType', type: 'string' },
@@ -28,6 +30,7 @@ const FIELD_SPECS = [
{ env: 'MEMORY_CANDIDATE_MIN_CONFIDENCE', group: 'candidateMemory', field: 'minConfidence', type: 'number' },
{ env: 'MEMORY_CANDIDATE_MAX_PENDING', group: 'candidateMemory', field: 'maxPending', type: 'number' },
{ env: 'MEMORY_CANDIDATE_PERSISTENCE_ENABLED', group: 'candidateMemory', field: 'persistenceEnabled', type: 'boolean' },
{ env: 'MEMORY_CANDIDATE_AUTO_ACCEPT_ALL', group: 'candidateMemory', field: 'autoAcceptAll', type: 'boolean' },
{ env: 'MEMORY_AGENT_RESOLVE_ENABLED', group: 'runtimeControl', field: 'agentResolveEnabled', type: 'boolean' },
{ env: 'MEMORY_AGENT_INJECTION_MODE', group: 'runtimeControl', field: 'agentInjectionMode', type: 'string' },
@@ -283,7 +286,7 @@ function applyEnv(config, secrets, env = process.env) {
config.chatIntentRouter.memoryResolveLimit = '8';
}
if (!normalizeString(config.chatIntentRouter.timeoutMs)) {
config.chatIntentRouter.timeoutMs = '2500';
config.chatIntentRouter.timeoutMs = '1200';
}
if (config.chatIntentRouter.enabled === undefined) {
config.chatIntentRouter.enabled = false;