@@ -4,12 +4,13 @@ import {
44 formatInboundMediaUnavailableText ,
55 formatMediaPlaceholderText ,
66 toInboundMediaFactsWithMetadata ,
7+ type ChannelInboundMediaInput ,
78 type ChannelInboundMediaPayload ,
89 type InboundMediaFacts ,
910 type MediaPlaceholderTextFact ,
1011} from "openclaw/plugin-sdk/channel-inbound" ;
1112import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime" ;
12- import type { MediaKind } from "openclaw/plugin-sdk/media-runtime" ;
13+ import type { MediaKind , SavedRemoteMedia } from "openclaw/plugin-sdk/media-runtime" ;
1314import {
1415 asDateTimestampMs ,
1516 resolveExpiresAtMsFromDurationMs ,
@@ -27,7 +28,9 @@ import {
2728} from "./client.js" ;
2829import { buildButtonProps , type MattermostInteractionResponse } from "./interactions.js" ;
2930
30- type MattermostMediaInfo = Omit < MediaPlaceholderTextFact , "kind" | "url" > & { kind : MediaKind } ;
31+ type MattermostMediaInfo = Pick < ChannelInboundMediaInput , "contentType" | "fileName" | "path" > & {
32+ kind : MediaKind ;
33+ } ;
3134
3235export async function buildMattermostInboundMediaPayload (
3336 media : readonly MattermostMediaInfo [ ] ,
@@ -76,7 +79,7 @@ type SaveRemoteMedia = (params: {
7679 ssrfPolicy ?: { allowedHostnames ?: string [ ] } ;
7780 responseHeaderTimeoutMs ?: number ;
7881 readIdleTimeoutMs ?: number ;
79- } ) => Promise < { path : string ; contentType ?: string | null } > ;
82+ } ) => Promise < Pick < SavedRemoteMedia , " contentType" | "fileName" | "path" > > ;
8083
8184export function createMattermostMonitorResources ( params : {
8285 accountId : string ;
@@ -171,6 +174,7 @@ export function createMattermostMonitorResources(params: {
171174 out . push ( {
172175 path : saved . path ,
173176 contentType,
177+ ...( saved . fileName ? { fileName : saved . fileName } : { } ) ,
174178 kind : mediaKindFromMime ( contentType ) ?? "unknown" ,
175179 } ) ;
176180 } catch ( err ) {
0 commit comments