refactor: dedupe lowercase string helpers

This commit is contained in:
Peter Steinberger
2026-04-07 10:11:52 +01:00
parent f1bdfca1ed
commit f54a57b80a
17 changed files with 67 additions and 78 deletions

View File

@@ -428,10 +428,10 @@ function buildArtifactContext(
}
const artifactContext = {
agentId: normalizeContextString(context.agentId),
sessionId: normalizeContextString(context.sessionId),
messageChannel: normalizeContextString(context.messageChannel),
agentAccountId: normalizeContextString(context.agentAccountId),
agentId: normalizeOptionalString(context.agentId),
sessionId: normalizeOptionalString(context.sessionId),
messageChannel: normalizeOptionalString(context.messageChannel),
agentAccountId: normalizeOptionalString(context.agentAccountId),
};
return Object.values(artifactContext).some((value) => value !== undefined)
@@ -439,11 +439,6 @@ function buildArtifactContext(
: undefined;
}
function normalizeContextString(value: string | undefined): string | undefined {
const normalized = normalizeOptionalString(value);
return normalized ? normalized : undefined;
}
function normalizeDiffInput(params: DiffsToolParams): DiffInput {
const patch = params.patch?.trim();
const before = params.before;