feat(h5): inject direct-chat history on agent escalation and defer ambiguous routing.

Phase B appends snapshot context when leaving h5direct sessions so Goose no longer starts blind. Phase C lets the 0.72 fallback return null on gated chat text so the existing LLM router can run, flags default off.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-28 20:45:34 +08:00
parent 6f48cad4c2
commit 5f3980e0df
9 changed files with 654 additions and 3 deletions
+21
View File
@@ -1054,6 +1054,27 @@ test('classifyWithRules routes memory recall to direct chat on fresh session', (
assert.equal(lastConversation.route, CHAT_INTENT_ROUTE.DIRECT_CHAT);
});
test('classifyWithRules defers ambiguous chat text to llm when chat session defer is enabled', () => {
const result = classifyWithRules({
text: '帮我比较一下英得尔和美的车载冰箱',
sessionId: 'h5direct_abc',
sessionMessageCount: 3,
chatSessionDeferEnabled: true,
chatSessionDeferMinTextLength: 12,
});
assert.equal(result, null);
});
test('classifyWithRules keeps memory recall on direct chat when defer is enabled', () => {
const result = classifyWithRules({
text: '你记得我说想去哪儿吗',
sessionId: 'h5direct_abc',
sessionMessageCount: 3,
chatSessionDeferEnabled: true,
});
assert.equal(result.route, CHAT_INTENT_ROUTE.DIRECT_CHAT);
});
test('createChatIntentRouter fast-paths news lookup to agent without LLM', async () => {
let llmCalls = 0;
const router = createChatIntentRouter({