mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
refactor(agents): narrow unused helper exports
This commit is contained in:
@@ -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) ?? "")
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user