refactor(media): remove common helper facades

This commit is contained in:
Vincent Koc
2026-06-18 10:14:28 +08:00
parent 665d2601e5
commit 4e6057e4dd
16 changed files with 23 additions and 32 deletions

View File

@@ -2,5 +2,5 @@
export { applyMediaUnderstanding } from "../../media-understanding/apply.js";
export { MediaAttachmentCache } from "../../media-understanding/attachments.js";
export { normalizeAttachments } from "../../media-understanding/attachments.normalize.js";
export { isMediaUnderstandingSkipError } from "../../media-understanding/errors.js";
export { isMediaUnderstandingSkipError } from "../../../packages/media-understanding-common/src/errors.js";
export { resolveMediaAttachmentLocalRoots } from "../../media-understanding/runner.js";

View File

@@ -7,7 +7,7 @@ import { AcpRuntimeError } from "../../acp/runtime/errors.js";
import type { AcpSessionStoreEntry } from "../../acp/runtime/session-meta.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { SessionBindingRecord } from "../../infra/outbound/session-binding-service.js";
import type { MediaUnderstandingSkipError } from "../../media-understanding/errors.js";
import type { MediaUnderstandingSkipError } from "../../../packages/media-understanding-common/src/errors.js";
import { withFetchPreconnect } from "../../test-utils/fetch-mock.js";
import {
resolveAgentAttachments,

View File

@@ -1,2 +0,0 @@
// Public facade for the shared active media model contract used by core and plugins.
export * from "../../packages/media-understanding-common/src/active-model.js";

View File

@@ -12,7 +12,12 @@ import { logVerbose, shouldLogVerbose } from "../globals.js";
import { renderFileContextBlock } from "../media/file-context.js";
import { extractFileContentFromSource, normalizeMimeType } from "../media/input-files.js";
import { wrapExternalContent } from "../security/external-content.js";
import type { ActiveMediaModel } from "./active-model.types.js";
import type { ActiveMediaModel } from "../../packages/media-understanding-common/src/active-model.js";
import {
extractMediaUserText,
formatAudioTranscripts,
formatMediaUnderstandingBody,
} from "../../packages/media-understanding-common/src/format.js";
import { resolveAttachmentKind } from "./attachments.js";
import { runWithConcurrency } from "./concurrency.js";
import { DEFAULT_ECHO_TRANSCRIPT_FORMAT, sendTranscriptEcho } from "./echo-transcript.js";
@@ -20,11 +25,6 @@ import {
type FileExtractionLimits,
resolveFileExtractionLimits,
} from "./file-extraction-limits.js";
import {
extractMediaUserText,
formatAudioTranscripts,
formatMediaUnderstandingBody,
} from "./format.js";
import { resolveConcurrency } from "./resolve.js";
import {
buildProviderRegistry,

View File

@@ -21,7 +21,7 @@ import {
import { getDefaultMediaLocalRoots } from "../media/local-roots.js";
import { buildRandomTempFilePath } from "../plugin-sdk/temp-path.js";
import { normalizeAttachmentPath } from "./attachments.normalize.js";
import { MediaUnderstandingSkipError } from "./errors.js";
import { MediaUnderstandingSkipError } from "../../packages/media-understanding-common/src/errors.js";
import type { MediaAttachment } from "./types.js";
type MediaBufferResult = {

View File

@@ -3,7 +3,7 @@
import type { MsgContext } from "../auto-reply/templating.js";
import type { OpenClawConfig } from "../config/types.js";
import { logVerbose, shouldLogVerbose } from "../globals.js";
import type { ActiveMediaModel } from "./active-model.types.js";
import type { ActiveMediaModel } from "../../packages/media-understanding-common/src/active-model.js";
import { isAudioAttachment } from "./attachments.js";
import { runAudioTranscription } from "./audio-transcription-runner.js";
import { DEFAULT_ECHO_TRANSCRIPT_FORMAT, sendTranscriptEcho } from "./echo-transcript.js";

View File

@@ -2,7 +2,7 @@
// pipeline and extracts the first transcript output.
import type { MsgContext } from "../auto-reply/templating.js";
import type { OpenClawConfig } from "../config/types.js";
import type { ActiveMediaModel } from "./active-model.types.js";
import type { ActiveMediaModel } from "../../packages/media-understanding-common/src/active-model.js";
import {
buildProviderRegistry,
createMediaAttachmentCache,

View File

@@ -4,12 +4,12 @@ import { normalizeOptionalString } from "@openclaw/normalization-core/string-coe
import { uniqueStrings } from "@openclaw/normalization-core/string-normalization";
import { resolveRuntimeConfigCacheKey } from "../config/runtime-snapshot.js";
import type { OpenClawConfig } from "../config/types.js";
import { providerSupportsCapability } from "../../packages/media-understanding-common/src/provider-supports.js";
import { buildMediaUnderstandingManifestMetadataRegistry } from "./manifest-metadata.js";
import {
normalizeMediaExecutionProviderId,
normalizeMediaProviderId,
} from "./provider-registry.js";
import { providerSupportsCapability } from "./provider-supports.js";
import type { MediaUnderstandingCapability, MediaUnderstandingProvider } from "./types.js";
export {
CLI_OUTPUT_MAX_BUFFER,

View File

@@ -1,2 +0,0 @@
// Core facade for shared media-understanding error classes and guards.
export * from "../../packages/media-understanding-common/src/errors.js";

View File

@@ -1,2 +0,0 @@
// Core facade for shared media-understanding formatting helpers.
export * from "../../packages/media-understanding-common/src/format.js";

View File

@@ -1,2 +0,0 @@
// Core facade for shared media-understanding output extraction helpers.
export * from "../../packages/media-understanding-common/src/output-extract.js";

View File

@@ -1,2 +0,0 @@
// Core facade for shared provider capability support checks.
export * from "../../packages/media-understanding-common/src/provider-supports.js";

View File

@@ -31,18 +31,22 @@ import { resolvePreferredOpenClawTmpDir } from "../infra/tmp-openclaw-dir.js";
import { runFfmpeg } from "../media/media-services.js";
import { runExec } from "../process/exec.js";
import { providerOperationRetryConfig } from "../provider-runtime/operation-retry.js";
import { MediaUnderstandingSkipError } from "../../packages/media-understanding-common/src/errors.js";
import { extractGeminiResponse } from "../../packages/media-understanding-common/src/output-extract.js";
import {
estimateBase64Size,
resolveVideoMaxBase64Bytes,
} from "../../packages/media-understanding-common/src/video.js";
import { MediaAttachmentCache } from "./attachments.js";
import {
CLI_OUTPUT_MAX_BUFFER,
DEFAULT_TIMEOUT_SECONDS,
MIN_AUDIO_FILE_BYTES,
} from "./defaults.constants.js";
import { MediaUnderstandingSkipError } from "./errors.js";
import { fileExists } from "./fs.js";
import { normalizeImageDescriptionInput } from "./image-input-normalize.js";
import { describeImageWithModel } from "./image-runtime.js";
import { resolveOpenAiAudioAuthModelApi } from "./openai-audio-api.js";
import { extractGeminiResponse } from "./output-extract.js";
import { normalizeMediaExecutionProviderId } from "./provider-id.js";
import { getMediaUnderstandingProvider, normalizeMediaProviderId } from "./provider-registry.js";
import { resolveMaxBytes, resolveMaxChars, resolvePrompt, resolveTimeoutMs } from "./resolve.js";
@@ -53,7 +57,6 @@ import type {
MediaUnderstandingOutput,
MediaUnderstandingProvider,
} from "./types.js";
import { estimateBase64Size, resolveVideoMaxBase64Bytes } from "./video.js";
type ProviderRegistry = Map<string, MediaUnderstandingProvider>;
type ResolveApiKeyForProvider = typeof import("../agents/model-auth.js").resolveApiKeyForProvider;

View File

@@ -38,9 +38,10 @@ import { logWarn } from "../logger.js";
import { resolveChannelInboundAttachmentRoots } from "../media/channel-inbound-roots.js";
import { getDefaultMediaLocalRoots } from "../media/local-roots.js";
import { runExec } from "../process/exec.js";
import type { ActiveMediaModel } from "./active-model.types.js";
import type { ActiveMediaModel } from "../../packages/media-understanding-common/src/active-model.js";
import { isMediaUnderstandingSkipError } from "../../packages/media-understanding-common/src/errors.js";
import { providerSupportsCapability } from "../../packages/media-understanding-common/src/provider-supports.js";
import { MediaAttachmentCache, selectAttachments } from "./attachments.js";
import { isMediaUnderstandingSkipError } from "./errors.js";
import { fileExists } from "./fs.js";
import { resolveOpenAiAudioAuthModelApi } from "./openai-audio-api.js";
import { normalizeMediaExecutionProviderId, normalizeMediaProviderId } from "./provider-id.js";
@@ -48,7 +49,6 @@ import {
buildMediaUnderstandingRegistry,
getMediaUnderstandingProvider,
} from "./provider-registry.js";
import { providerSupportsCapability } from "./provider-supports.js";
import { resolveModelEntries, resolveScopeDecision } from "./resolve.js";
import {
buildModelDecision,
@@ -65,7 +65,7 @@ import type {
MediaUnderstandingProvider,
} from "./types.js";
export { createMediaAttachmentCache, normalizeMediaAttachments } from "./runner.attachments.js";
export type { ActiveMediaModel } from "./active-model.types.js";
export type { ActiveMediaModel } from "../../packages/media-understanding-common/src/active-model.js";
type ProviderRegistry = Map<string, MediaUnderstandingProvider>;
type HasAvailableAuthForProvider =

View File

@@ -2,7 +2,7 @@
// helpers and direct structured extraction.
import type { AuthProfileStore } from "../agents/auth-profiles/types.js";
import type { OpenClawConfig } from "../config/types.js";
import type { ActiveMediaModel } from "./active-model.types.js";
import type { ActiveMediaModel } from "../../packages/media-understanding-common/src/active-model.js";
import type {
MediaUnderstandingDecision,
MediaUnderstandingOutput,

View File

@@ -1,2 +0,0 @@
// Core facade for shared media-understanding video helpers.
export * from "../../packages/media-understanding-common/src/video.js";