perf(main): reduce bootstrap transcript context scans
This commit is contained in:
parent
2f0abb430c
commit
ab8ed5e378
1 changed files with 32 additions and 8 deletions
|
|
@ -318,7 +318,6 @@ import {
|
||||||
getBootstrapTranscriptSuccessSource,
|
getBootstrapTranscriptSuccessSource,
|
||||||
getCanonicalSendMessageFieldRule,
|
getCanonicalSendMessageFieldRule,
|
||||||
getCanonicalSendMessageToolRule,
|
getCanonicalSendMessageToolRule,
|
||||||
isBootstrapTranscriptContextText,
|
|
||||||
isTaskBoardSnapshotWorkCandidate,
|
isTaskBoardSnapshotWorkCandidate,
|
||||||
normalizeMemberDiagnosticText,
|
normalizeMemberDiagnosticText,
|
||||||
shouldUseGeminiStagedLaunch,
|
shouldUseGeminiStagedLaunch,
|
||||||
|
|
@ -740,6 +739,28 @@ interface ParsedBootstrapTranscriptTailCacheEntry {
|
||||||
lines: ParsedBootstrapTranscriptTailLine[];
|
lines: ParsedBootstrapTranscriptTailLine[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isNormalizedBootstrapTranscriptContextText(
|
||||||
|
normalizedText: string,
|
||||||
|
normalizedTeamName: string,
|
||||||
|
normalizedMemberName: string
|
||||||
|
): boolean {
|
||||||
|
if (!normalizedText || !normalizedTeamName || !normalizedMemberName) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!normalizedText.includes(normalizedTeamName) ||
|
||||||
|
!normalizedText.includes(normalizedMemberName)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
normalizedText.includes('bootstrap') ||
|
||||||
|
normalizedText.includes('bootstrapping') ||
|
||||||
|
normalizedText.includes('member briefing') ||
|
||||||
|
normalizedText.includes('task briefing')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
ActiveToolCall,
|
ActiveToolCall,
|
||||||
AgentActionMode,
|
AgentActionMode,
|
||||||
|
|
@ -30426,6 +30447,7 @@ export class TeamProvisioningService {
|
||||||
} = {}
|
} = {}
|
||||||
): Promise<BootstrapTranscriptOutcome | null> {
|
): Promise<BootstrapTranscriptOutcome | null> {
|
||||||
const normalizedMemberName = memberName.trim().toLowerCase();
|
const normalizedMemberName = memberName.trim().toLowerCase();
|
||||||
|
const normalizedTeamName = teamName.trim().toLowerCase();
|
||||||
const contextMemberNames = Array.from(
|
const contextMemberNames = Array.from(
|
||||||
new Set(
|
new Set(
|
||||||
[memberName, ...(options.contextMemberNames ?? [])]
|
[memberName, ...(options.contextMemberNames ?? [])]
|
||||||
|
|
@ -30433,6 +30455,9 @@ export class TeamProvisioningService {
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
const normalizedContextMemberNames = contextMemberNames.map((name) =>
|
||||||
|
name.trim().toLowerCase()
|
||||||
|
);
|
||||||
const cacheKey = this.buildBootstrapTranscriptOutcomeCacheKey({
|
const cacheKey = this.buildBootstrapTranscriptOutcomeCacheKey({
|
||||||
filePath,
|
filePath,
|
||||||
sinceMs,
|
sinceMs,
|
||||||
|
|
@ -30477,16 +30502,15 @@ export class TeamProvisioningService {
|
||||||
}
|
}
|
||||||
const lineNormalizedText = normalizedText ?? '';
|
const lineNormalizedText = normalizedText ?? '';
|
||||||
if (shouldCollectBootstrapContext) {
|
if (shouldCollectBootstrapContext) {
|
||||||
for (const contextMemberName of contextMemberNames) {
|
for (const contextMemberName of normalizedContextMemberNames) {
|
||||||
if (
|
if (
|
||||||
isBootstrapTranscriptContextText(
|
isNormalizedBootstrapTranscriptContextText(
|
||||||
text,
|
lineNormalizedText,
|
||||||
teamName,
|
normalizedTeamName,
|
||||||
contextMemberName,
|
contextMemberName
|
||||||
lineNormalizedText
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
bootstrapContextMembers.add(contextMemberName.trim().toLowerCase());
|
bootstrapContextMembers.add(contextMemberName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue