feat(context): add recall fusion and zvec workspace adapters
Introduce RRF-based recall fusion for personal/episodic/temporal paths, zvec-grep workspace shadow probing for code executors, and a local headroom proxy starter aligned with the fusion plan defaults. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import { getActiveSnapshot } from '../user-model-service/snapshot.mjs';
|
||||
import { createUmsPool, isUmsDatabaseConfigured } from '../user-model-service/db.mjs';
|
||||
import { resolveCanonicalUserId } from '../user-model-service/canonical-user.mjs';
|
||||
import {
|
||||
buildRecallFusionResolvedEvent,
|
||||
fuseRecallCandidates,
|
||||
resolveRecallFusionMode,
|
||||
} from '../recall-fusion.mjs';
|
||||
import { buildContextPlan } from './context-planner.mjs';
|
||||
import { queryTemporalRecall } from './recall.mjs';
|
||||
|
||||
@@ -164,12 +169,30 @@ export async function resolveRuntimeContext(input) {
|
||||
}
|
||||
}
|
||||
|
||||
let recallFusion = null;
|
||||
if (resolveRecallFusionMode() !== 'off' && temporalRecall) {
|
||||
const temporalItems = [
|
||||
...(Array.isArray(temporalRecall.items) ? temporalRecall.items : []),
|
||||
...(Array.isArray(temporalRecall.groups)
|
||||
? temporalRecall.groups.flatMap((group) => group.items ?? [])
|
||||
: []),
|
||||
];
|
||||
if (temporalItems.length > 0) {
|
||||
recallFusion = buildRecallFusionResolvedEvent(fuseRecallCandidates({
|
||||
query,
|
||||
temporalItems,
|
||||
limit: plan.output?.max_items ?? 20,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
const injectionEnabled = Boolean(blocks.temporal || blocks.snapshot);
|
||||
return {
|
||||
enabled: true,
|
||||
plan,
|
||||
temporalRecall,
|
||||
userSnapshot,
|
||||
recallFusion,
|
||||
injectionEnabled,
|
||||
blocks,
|
||||
injectionText: [blocks.snapshot, blocks.temporal].filter(Boolean).join('\n\n'),
|
||||
|
||||
Reference in New Issue
Block a user