perf(main): cache bootstrap transcript success checks
This commit is contained in:
parent
228ebd6454
commit
fdc61d55cb
1 changed files with 27 additions and 1 deletions
|
|
@ -733,6 +733,7 @@ interface ParsedBootstrapTranscriptTailLine {
|
|||
bootstrapFailureReason?: string | null;
|
||||
bootstrapContextCandidateByTeam?: Map<string, boolean>;
|
||||
bootstrapContextMemberMatchByName?: Map<string, boolean>;
|
||||
bootstrapSuccessSourceByTeamMember?: Map<string, BootstrapTranscriptSuccessSource | null>;
|
||||
}
|
||||
|
||||
interface ParsedBootstrapTranscriptTailCacheEntry {
|
||||
|
|
@ -810,6 +811,30 @@ function getCachedBootstrapContextMemberMatchForLine(
|
|||
return value;
|
||||
}
|
||||
|
||||
function getCachedBootstrapSuccessSourceForLine(
|
||||
line: ParsedBootstrapTranscriptTailLine,
|
||||
normalizedText: string,
|
||||
normalizedTeamName: string,
|
||||
normalizedMemberName: string
|
||||
): BootstrapTranscriptSuccessSource | null {
|
||||
let sourceByTeamMember = line.bootstrapSuccessSourceByTeamMember;
|
||||
if (!sourceByTeamMember) {
|
||||
sourceByTeamMember = new Map<string, BootstrapTranscriptSuccessSource | null>();
|
||||
line.bootstrapSuccessSourceByTeamMember = sourceByTeamMember;
|
||||
}
|
||||
const cacheKey = `${normalizedTeamName}\0${normalizedMemberName}`;
|
||||
if (sourceByTeamMember.has(cacheKey)) {
|
||||
return sourceByTeamMember.get(cacheKey) ?? null;
|
||||
}
|
||||
const source = getBootstrapTranscriptSuccessSourceFromNormalized(
|
||||
normalizedText,
|
||||
normalizedTeamName,
|
||||
normalizedMemberName
|
||||
);
|
||||
sourceByTeamMember.set(cacheKey, source);
|
||||
return source;
|
||||
}
|
||||
|
||||
import type {
|
||||
ActiveToolCall,
|
||||
AgentActionMode,
|
||||
|
|
@ -30646,7 +30671,8 @@ export class TeamProvisioningService {
|
|||
outcome = { kind: 'failure', observedAt: candidate.observedAt, reason };
|
||||
break;
|
||||
}
|
||||
const successSource = getBootstrapTranscriptSuccessSourceFromNormalized(
|
||||
const successSource = getCachedBootstrapSuccessSourceForLine(
|
||||
cachedLine,
|
||||
candidate.normalizedText,
|
||||
normalizedTeamName,
|
||||
normalizedMemberName
|
||||
|
|
|
|||
Loading…
Reference in a new issue