e45c9300bf
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>
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
export const MEMORY_INTERVENTION_MODE = {
|
|
SKIP: 'skip',
|
|
LIGHT: 'light',
|
|
HEAVY: 'heavy',
|
|
};
|
|
|
|
export const MEMORY_INTERVENTION_LIMIT = {
|
|
LIGHT_ROUTER: 3,
|
|
LIGHT_DIRECT_CHAT: 5,
|
|
LIGHT_AGENT: 3,
|
|
HEAVY: 40,
|
|
};
|
|
|
|
export function resolveMemoryInterventionMode({
|
|
forceDeepReasoning = false,
|
|
recallQuestion = false,
|
|
context = 'router',
|
|
} = {}) {
|
|
if (forceDeepReasoning) return MEMORY_INTERVENTION_MODE.HEAVY;
|
|
if (context === 'router') {
|
|
return recallQuestion ? MEMORY_INTERVENTION_MODE.LIGHT : MEMORY_INTERVENTION_MODE.SKIP;
|
|
}
|
|
return MEMORY_INTERVENTION_MODE.LIGHT;
|
|
}
|
|
|
|
export function memoryLimitForIntervention(mode, { context = 'router' } = {}) {
|
|
if (mode === MEMORY_INTERVENTION_MODE.HEAVY) {
|
|
return MEMORY_INTERVENTION_LIMIT.HEAVY;
|
|
}
|
|
if (mode === MEMORY_INTERVENTION_MODE.SKIP) {
|
|
return 0;
|
|
}
|
|
if (context === 'direct_chat') {
|
|
return MEMORY_INTERVENTION_LIMIT.LIGHT_DIRECT_CHAT;
|
|
}
|
|
if (context === 'agent') {
|
|
return MEMORY_INTERVENTION_LIMIT.LIGHT_AGENT;
|
|
}
|
|
return MEMORY_INTERVENTION_LIMIT.LIGHT_ROUTER;
|
|
}
|