Version 2.46.0 Release: Autonomous Anti-Blocking Generation and Trace Relevance Refinement
This commit is contained in:
@@ -390,12 +390,14 @@ function scoreFile(file: string, brainRoot: string, terms: string[], intent: Sec
|
||||
content = '';
|
||||
}
|
||||
const sourceType = classifySourceType(relative, content);
|
||||
const canSupportProjectClaim = sourceType === 'Project Evidence' || sourceType === 'User Decision';
|
||||
|
||||
const lower = content.toLowerCase();
|
||||
const documentProject = inferDocumentProject(relative, lower);
|
||||
const projectMatchesTarget = !targetProject || !documentProject || documentProject === targetProject;
|
||||
const canSupportProjectClaim = projectMatchesTarget && (sourceType === 'Project Evidence' || sourceType === 'User Decision');
|
||||
let score = pathPriority(relative, intent);
|
||||
if (targetProject) {
|
||||
score += projectRelevanceScore(relative, lower, targetProject);
|
||||
score += projectRelevanceScore(relative, lower, targetProject, documentProject);
|
||||
}
|
||||
for (const term of terms) {
|
||||
if (basename.includes(term)) score += 4;
|
||||
@@ -417,17 +419,25 @@ function scoreFile(file: string, brainRoot: string, terms: string[], intent: Sec
|
||||
};
|
||||
}
|
||||
|
||||
function projectRelevanceScore(relativePath: string, lowerContent: string, targetProject: string): number {
|
||||
function inferDocumentProject(relativePath: string, lowerContent: string): string | undefined {
|
||||
const normalized = relativePath.toLowerCase();
|
||||
const pathProject = `${normalized}\n${lowerContent}`.match(/\/volumes\/data\/project\/antigravity\/([a-z0-9_-]+)/i)
|
||||
|| `${normalized}\n${lowerContent}`.match(/(?:^|[\\/])(connectai|datacollector|skybound)(?:[\\/]|_|-|\b)/i);
|
||||
if (pathProject?.[1]) return pathProject[1].toLowerCase();
|
||||
|
||||
const labeledProject = lowerContent.match(/(?:project|프로젝트)\s*[::]\s*`?([a-z0-9_-]+)/i);
|
||||
return labeledProject?.[1]?.toLowerCase();
|
||||
}
|
||||
|
||||
function projectRelevanceScore(relativePath: string, lowerContent: string, targetProject: string, documentProject?: string): number {
|
||||
const normalized = relativePath.toLowerCase();
|
||||
let score = 0;
|
||||
if (normalized.includes(targetProject)) score += 12;
|
||||
const targetMatches = lowerContent.split(targetProject).length - 1;
|
||||
if (targetMatches > 0) score += Math.min(targetMatches * 4, 20);
|
||||
|
||||
const otherProjectMatch = lowerContent.match(/(?:project|프로젝트|repository|repo)\s*[::]?\s*`?\/?volumes\/data\/project\/antigravity\/([a-z0-9_-]+)/i)
|
||||
|| lowerContent.match(/(?:project|프로젝트)\s*[::]\s*([a-z0-9_-]+)/i);
|
||||
const otherProject = otherProjectMatch?.[1]?.toLowerCase();
|
||||
if (otherProject && otherProject !== targetProject) score -= 24;
|
||||
const otherProject = documentProject && documentProject !== targetProject ? documentProject : undefined;
|
||||
if (otherProject) score -= 32;
|
||||
|
||||
if (normalized.includes('project_logs') && otherProject && otherProject !== targetProject) score -= 8;
|
||||
return score;
|
||||
|
||||
Reference in New Issue
Block a user