perf(main): reuse normalized bootstrap success inputs

This commit is contained in:
777genius 2026-05-31 06:12:57 +03:00
parent 743bef8f30
commit a0faab56aa
2 changed files with 21 additions and 6 deletions

View file

@ -315,7 +315,7 @@ import {
extractBootstrapFailureReason,
extractHeartbeatTimestamp,
extractTranscriptMessageText,
getBootstrapTranscriptSuccessSource,
getBootstrapTranscriptSuccessSourceFromNormalized,
getCanonicalSendMessageFieldRule,
getCanonicalSendMessageToolRule,
isTaskBoardSnapshotWorkCandidate,
@ -30598,11 +30598,10 @@ export class TeamProvisioningService {
outcome = { kind: 'failure', observedAt: candidate.observedAt, reason };
break;
}
const successSource = getBootstrapTranscriptSuccessSource(
candidate.text,
teamName,
memberName,
candidate.normalizedText
const successSource = getBootstrapTranscriptSuccessSourceFromNormalized(
candidate.normalizedText,
normalizedTeamName,
normalizedMemberName
);
if (successSource) {
outcome = { kind: 'success', observedAt: candidate.observedAt, source: successSource };

View file

@ -282,6 +282,22 @@ export function getBootstrapTranscriptSuccessSource(
return null;
}
return getBootstrapTranscriptSuccessSourceFromNormalized(
normalizedText,
normalizedTeamName,
normalizedMemberName
);
}
export function getBootstrapTranscriptSuccessSourceFromNormalized(
normalizedText: string,
normalizedTeamName: string,
normalizedMemberName: string
): BootstrapTranscriptSuccessSource | null {
if (!normalizedText || !normalizedTeamName || !normalizedMemberName) {
return null;
}
if (
normalizedText.startsWith(
`member briefing for ${normalizedMemberName} on team "${normalizedTeamName}" (${normalizedTeamName}).`