From 9d4a98e5991d23dd31658d5e2b8b0bb8ccb9d8d5 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 2 May 2026 03:22:08 +0100 Subject: [PATCH] refactor: trim media understanding helper types --- src/media-understanding/errors.ts | 2 +- src/media-understanding/output-extract.ts | 2 +- src/media-understanding/runtime-types.ts | 2 +- src/media-understanding/scope.ts | 2 +- src/media-understanding/types.ts | 17 +++++++---------- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/media-understanding/errors.ts b/src/media-understanding/errors.ts index 77a31368178..e6475f722c7 100644 --- a/src/media-understanding/errors.ts +++ b/src/media-understanding/errors.ts @@ -1,4 +1,4 @@ -export type MediaUnderstandingSkipReason = +type MediaUnderstandingSkipReason = | "maxBytes" | "timeout" | "unsupported" diff --git a/src/media-understanding/output-extract.ts b/src/media-understanding/output-extract.ts index e8bf57c9519..a0f0f391379 100644 --- a/src/media-understanding/output-extract.ts +++ b/src/media-understanding/output-extract.ts @@ -1,4 +1,4 @@ -export function extractLastJsonObject(raw: string): unknown { +function extractLastJsonObject(raw: string): unknown { const trimmed = raw.trim(); const start = trimmed.lastIndexOf("{"); if (start === -1) { diff --git a/src/media-understanding/runtime-types.ts b/src/media-understanding/runtime-types.ts index 3f22b226e4e..b31d062eb58 100644 --- a/src/media-understanding/runtime-types.ts +++ b/src/media-understanding/runtime-types.ts @@ -42,7 +42,7 @@ export type DescribeImageFileWithModelParams = { timeoutMs?: number; }; -export type DescribeImageFileWithModelResult = Awaited< +type DescribeImageFileWithModelResult = Awaited< ReturnType> >; diff --git a/src/media-understanding/scope.ts b/src/media-understanding/scope.ts index f61a9cca94a..3dbd30bae27 100644 --- a/src/media-understanding/scope.ts +++ b/src/media-understanding/scope.ts @@ -2,7 +2,7 @@ import { normalizeChatType } from "../channels/chat-type.js"; import type { MediaUnderstandingScopeConfig } from "../config/types.tools.js"; import { normalizeOptionalLowercaseString } from "../shared/string-coerce.js"; -export type MediaUnderstandingScopeDecision = "allow" | "deny"; +type MediaUnderstandingScopeDecision = "allow" | "deny"; function normalizeDecision(value?: string | null): MediaUnderstandingScopeDecision | undefined { const normalized = normalizeOptionalLowercaseString(value); diff --git a/src/media-understanding/types.ts b/src/media-understanding/types.ts index 18843cfbfc1..205b5e772c4 100644 --- a/src/media-understanding/types.ts +++ b/src/media-understanding/types.ts @@ -1,10 +1,7 @@ import type { AuthProfileStore } from "../agents/auth-profiles/types.js"; import type { OpenClawConfig } from "../config/types.openclaw.js"; -export type MediaUnderstandingKind = - | "audio.transcription" - | "video.description" - | "image.description"; +type MediaUnderstandingKind = "audio.transcription" | "video.description" | "image.description"; export type MediaUnderstandingCapability = "image" | "audio" | "video"; @@ -31,7 +28,7 @@ export type MediaUnderstandingOutput = { model?: string; }; -export type MediaUnderstandingDecisionOutcome = +type MediaUnderstandingDecisionOutcome = | "success" | "failed" | "skipped" @@ -47,7 +44,7 @@ export type MediaUnderstandingModelDecision = { reason?: string; }; -export type MediaUnderstandingAttachmentDecision = { +type MediaUnderstandingAttachmentDecision = { attachmentIndex: number; attempts: MediaUnderstandingModelDecision[]; chosen?: MediaUnderstandingModelDecision; @@ -59,12 +56,12 @@ export type MediaUnderstandingDecision = { attachments: MediaUnderstandingAttachmentDecision[]; }; -export type MediaUnderstandingProviderRequestAuthOverride = +type MediaUnderstandingProviderRequestAuthOverride = | { mode: "provider-default" } | { mode: "authorization-bearer"; token: string } | { mode: "header"; headerName: string; value: string; prefix?: string }; -export type MediaUnderstandingProviderRequestTlsOverride = { +type MediaUnderstandingProviderRequestTlsOverride = { ca?: string; cert?: string; key?: string; @@ -73,11 +70,11 @@ export type MediaUnderstandingProviderRequestTlsOverride = { insecureSkipVerify?: boolean; }; -export type MediaUnderstandingProviderRequestProxyOverride = +type MediaUnderstandingProviderRequestProxyOverride = | { mode: "env-proxy"; tls?: MediaUnderstandingProviderRequestTlsOverride } | { mode: "explicit-proxy"; url: string; tls?: MediaUnderstandingProviderRequestTlsOverride }; -export type MediaUnderstandingProviderRequestTransportOverrides = { +type MediaUnderstandingProviderRequestTransportOverrides = { headers?: Record; auth?: MediaUnderstandingProviderRequestAuthOverride; proxy?: MediaUnderstandingProviderRequestProxyOverride;