diff --git a/src/auto-reply/reply/dispatch-acp-media.runtime.ts b/src/auto-reply/reply/dispatch-acp-media.runtime.ts index fa09282edb6c..bd0653c33649 100644 --- a/src/auto-reply/reply/dispatch-acp-media.runtime.ts +++ b/src/auto-reply/reply/dispatch-acp-media.runtime.ts @@ -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"; diff --git a/src/auto-reply/reply/dispatch-acp.test.ts b/src/auto-reply/reply/dispatch-acp.test.ts index f6fb70bddd0c..f4673d129818 100644 --- a/src/auto-reply/reply/dispatch-acp.test.ts +++ b/src/auto-reply/reply/dispatch-acp.test.ts @@ -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, diff --git a/src/media-understanding/active-model.types.ts b/src/media-understanding/active-model.types.ts deleted file mode 100644 index be9426009c52..000000000000 --- a/src/media-understanding/active-model.types.ts +++ /dev/null @@ -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"; diff --git a/src/media-understanding/apply.ts b/src/media-understanding/apply.ts index 1b68d818057f..461d81d5709f 100644 --- a/src/media-understanding/apply.ts +++ b/src/media-understanding/apply.ts @@ -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, diff --git a/src/media-understanding/attachments.cache.ts b/src/media-understanding/attachments.cache.ts index 7c79294fc6c9..1a575106f41c 100644 --- a/src/media-understanding/attachments.cache.ts +++ b/src/media-understanding/attachments.cache.ts @@ -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 = { diff --git a/src/media-understanding/audio-preflight.ts b/src/media-understanding/audio-preflight.ts index c6259558f383..a21a4f3f39a7 100644 --- a/src/media-understanding/audio-preflight.ts +++ b/src/media-understanding/audio-preflight.ts @@ -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"; diff --git a/src/media-understanding/audio-transcription-runner.ts b/src/media-understanding/audio-transcription-runner.ts index cedf3fb5aa47..2d5eeb6d86c3 100644 --- a/src/media-understanding/audio-transcription-runner.ts +++ b/src/media-understanding/audio-transcription-runner.ts @@ -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, diff --git a/src/media-understanding/defaults.ts b/src/media-understanding/defaults.ts index 9bbcbd0d04f5..f1af47d5b657 100644 --- a/src/media-understanding/defaults.ts +++ b/src/media-understanding/defaults.ts @@ -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, diff --git a/src/media-understanding/errors.ts b/src/media-understanding/errors.ts deleted file mode 100644 index 5ce50bd2f45b..000000000000 --- a/src/media-understanding/errors.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Core facade for shared media-understanding error classes and guards. -export * from "../../packages/media-understanding-common/src/errors.js"; diff --git a/src/media-understanding/format.ts b/src/media-understanding/format.ts deleted file mode 100644 index f2a822c07874..000000000000 --- a/src/media-understanding/format.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Core facade for shared media-understanding formatting helpers. -export * from "../../packages/media-understanding-common/src/format.js"; diff --git a/src/media-understanding/output-extract.ts b/src/media-understanding/output-extract.ts deleted file mode 100644 index a5110be3faa0..000000000000 --- a/src/media-understanding/output-extract.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Core facade for shared media-understanding output extraction helpers. -export * from "../../packages/media-understanding-common/src/output-extract.js"; diff --git a/src/media-understanding/provider-supports.ts b/src/media-understanding/provider-supports.ts deleted file mode 100644 index 13ede1682e27..000000000000 --- a/src/media-understanding/provider-supports.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Core facade for shared provider capability support checks. -export * from "../../packages/media-understanding-common/src/provider-supports.js"; diff --git a/src/media-understanding/runner.entries.ts b/src/media-understanding/runner.entries.ts index 10352a906dd1..8f6e2569cf83 100644 --- a/src/media-understanding/runner.entries.ts +++ b/src/media-understanding/runner.entries.ts @@ -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; type ResolveApiKeyForProvider = typeof import("../agents/model-auth.js").resolveApiKeyForProvider; diff --git a/src/media-understanding/runner.ts b/src/media-understanding/runner.ts index cbda40808f44..1c16497ab563 100644 --- a/src/media-understanding/runner.ts +++ b/src/media-understanding/runner.ts @@ -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; type HasAvailableAuthForProvider = diff --git a/src/media-understanding/runtime-types.ts b/src/media-understanding/runtime-types.ts index ec16767837e7..e1a89173c42b 100644 --- a/src/media-understanding/runtime-types.ts +++ b/src/media-understanding/runtime-types.ts @@ -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, diff --git a/src/media-understanding/video.ts b/src/media-understanding/video.ts deleted file mode 100644 index 792be9f3d8d5..000000000000 --- a/src/media-understanding/video.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Core facade for shared media-understanding video helpers. -export * from "../../packages/media-understanding-common/src/video.js";