feat: LLM intent router, direct chat execution, and Memory V2 light intervention

Wire chat intent routing with direct_chat on regular sessions, skill-selected
short-circuit to Agent, memory light/heavy intervention tiers, and fix direct
chat UI stuck streaming after completion.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-04 22:32:57 +08:00
parent bfb6356f7d
commit e45c9300bf
33 changed files with 3412 additions and 105 deletions
+29
View File
@@ -12,6 +12,16 @@ const FIELD_SPECS = [
{ env: 'MEMORY_VECTOR_ENABLED', group: 'global', field: 'vectorEnabled', type: 'boolean' },
{ 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_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' },
{ env: 'MEMIND_CHAT_ROUTER_MIN_CONFIDENCE', group: 'chatIntentRouter', field: 'minConfidence', type: 'number' },
{ env: 'MEMIND_CHAT_ROUTER_MEMORY_ENABLED', group: 'chatIntentRouter', field: 'memoryResolveEnabled', type: 'boolean' },
{ env: 'MEMIND_CHAT_ROUTER_MEMORY_LIMIT', group: 'chatIntentRouter', field: 'memoryResolveLimit', type: 'number' },
{ env: 'MEMIND_CHAT_ROUTER_TIMEOUT_MS', group: 'chatIntentRouter', field: 'timeoutMs', type: 'number' },
{ env: 'MEMIND_CHAT_ROUTER_FALLBACK_ROUTE', group: 'chatIntentRouter', field: 'fallbackRoute', type: 'string' },
{ env: 'MEMORY_PGVECTOR_ENABLED', group: 'pgvector', field: 'enabled', type: 'boolean' },
{ env: 'MEMORY_PGVECTOR_DATABASE_URL', group: 'pgvector', field: 'databaseUrl', type: 'secret' },
{ env: 'MEMORY_PGVECTOR_TABLE', group: 'pgvector', field: 'table', type: 'string' },
@@ -84,6 +94,7 @@ const FIELD_SPECS = [
const GROUPS = [
'global',
'chatIntentRouter',
'pgvector',
'qdrant',
'weaviate',
@@ -183,6 +194,24 @@ function applyEnv(config, secrets, env = process.env) {
if (config.pgvector.enabled === undefined) {
config.pgvector.enabled = normalizeBoolean(env?.MEMORY_VECTOR_ENABLED, false);
}
if (env?.MEMIND_CHAT_ROUTER_MEMORY_ENABLED == null || String(env.MEMIND_CHAT_ROUTER_MEMORY_ENABLED).trim() === '') {
config.chatIntentRouter.memoryResolveEnabled = true;
}
if (!normalizeString(config.chatIntentRouter.modelApiType)) {
config.chatIntentRouter.modelApiType = 'chat';
}
if (!normalizeString(config.chatIntentRouter.minConfidence)) {
config.chatIntentRouter.minConfidence = '0.65';
}
if (!normalizeString(config.chatIntentRouter.memoryResolveLimit)) {
config.chatIntentRouter.memoryResolveLimit = '8';
}
if (!normalizeString(config.chatIntentRouter.timeoutMs)) {
config.chatIntentRouter.timeoutMs = '1500';
}
if (!normalizeString(config.chatIntentRouter.fallbackRoute)) {
config.chatIntentRouter.fallbackRoute = 'agent_orchestration';
}
return { config, secrets };
}