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
+50 -1
View File
@@ -406,7 +406,7 @@ test('startSessionForUser resolves memories through Memory V2 facade', async ()
userId: 'user-1',
sessionId: 'session-1',
query: null,
limit: 40,
limit: 3,
});
assert.ok(
harnessEntries.some((entry) => String(entry.content ?? '').includes('用户关注 Memory V2 架构边界')),
@@ -577,6 +577,55 @@ test('submitSessionReplyForUser passes current prompt to Memory V2 resolve befor
},
);
assert.deepEqual(resolveInput, {
userId: 'user-1',
sessionId: 'session-1',
query: '帮我设计 memory-chain 下一阶段',
limit: 3,
});
});
});
test('submitSessionReplyForUser uses heavy memory resolve when deep reasoning is enabled', async () => {
let resolveInput = null;
await withFakeGoosedSession(async ({ apiTarget, workingDir }) => {
const proxy = createTkmindProxy({
apiTarget,
apiSecret: 'test-secret',
userAuth: {
...createMemoryTestUserAuth(workingDir),
async ownsSession() {
return true;
},
async canUseChat() {
return { ok: true };
},
async getUserById() {
return { id: 'user-1' };
},
async resolveUserPolicies() {
return { unrestricted: true, policies: {} };
},
},
memoryV2: {
async resolve(input) {
resolveInput = input;
return { memories: [] };
},
},
});
await proxy.submitSessionReplyForUser(
'user-1',
'session-1',
'request-1',
{
role: 'user',
content: [{ type: 'text', text: '帮我设计 memory-chain 下一阶段' }],
},
{ forceDeepReasoning: true },
);
assert.deepEqual(resolveInput, {
userId: 'user-1',
sessionId: 'session-1',