refactor(agents): narrow unused helper exports

This commit is contained in:
Vincent Koc
2026-06-16 18:22:00 +08:00
parent 623761e5c5
commit 4292f0fe7f
3 changed files with 3 additions and 19 deletions
+2 -8
View File
@@ -17,10 +17,7 @@ export type AgentGeneratedAttachment = {
name?: string;
};
/** Resolve the first usable path or URL reference for a generated attachment. */
export function generatedAttachmentReference(
attachment: AgentGeneratedAttachment,
): string | undefined {
function generatedAttachmentReference(attachment: AgentGeneratedAttachment): string | undefined {
return normalizeOptionalString(
attachment.path ?? attachment.url ?? attachment.mediaUrl ?? attachment.filePath,
);
@@ -35,10 +32,7 @@ export function mediaUrlsFromGeneratedAttachments(
);
}
/** Resolve a display name from attachment metadata or path basename. */
export function nameFromGeneratedAttachment(
attachment: AgentGeneratedAttachment,
): string | undefined {
function nameFromGeneratedAttachment(attachment: AgentGeneratedAttachment): string | undefined {
return (
normalizeOptionalString(attachment.name) ??
basenameFromAnyPath(generatedAttachmentReference(attachment) ?? "")
-10
View File
@@ -173,11 +173,6 @@ export function collectAnthropicApiKeys(): string[] {
return collectProviderApiKeys("anthropic");
}
/** Collect Gemini API keys for live cache/model tests. */
export function collectGeminiApiKeys(): string[] {
return collectProviderApiKeys("google");
}
/** Return whether a provider error message indicates API-key rate limiting. */
export function isApiKeyRateLimitError(message: string): boolean {
const lower = normalizeLowercaseStringOrEmpty(message);
@@ -202,11 +197,6 @@ export function isApiKeyRateLimitError(message: string): boolean {
return false;
}
/** Return whether an Anthropic error message indicates rate limiting. */
export function isAnthropicRateLimitError(message: string): boolean {
return isApiKeyRateLimitError(message);
}
/** Return whether an Anthropic error message indicates billing exhaustion. */
export function isAnthropicBillingError(message: string): boolean {
const lower = normalizeLowercaseStringOrEmpty(message);
+1 -1
View File
@@ -16,7 +16,7 @@ import { loadUndiciRuntimeDeps } from "../infra/net/undici-runtime.js";
export type { FetchLike };
/** Default MCP HTTP fetch backed by lazy-loaded undici runtime deps. */
export const fetchWithUndici: FetchLike = async (url, init) =>
const fetchWithUndici: FetchLike = async (url, init) =>
(await loadUndiciRuntimeDeps().fetch(
url,
init as Parameters<ReturnType<typeof loadUndiciRuntimeDeps>["fetch"]>[1],