Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(channels): add media attachment types and cache directory

Naiyuan Qing020d132260ce
diff --git a/src/channels/types.ts b/src/channels/types.ts
index 0832e6ed12..0486f39335 100644
--- a/src/channels/types.ts
+++ b/src/channels/types.ts
@@ -7,6 +7,25 @@
import type { BlockChunkerConfig } from "../hub/block-chunker.js";
+// ─── Media Attachment ───
+
+/** Media type for incoming channel attachments */
+export type ChannelMediaType = "audio" | "image" | "video" | "document";
+
+/** Media attachment from a channel message */
+export interface ChannelMediaAttachment {
+ /** Media type */
+ type: ChannelMediaType;
+ /** Platform-specific file ID (used for download) */
+ fileId: string;
+ /** MIME type if known (e.g. "audio/ogg", "image/jpeg") */
+ mimeType?: string | undefined;
+ /** Duration in seconds (for audio/video) */
+ duration?: number | undefined;
+ /** Caption text attached to the media */
+ caption?: string | undefined;
+}
+
// ─── Normalized Incoming Message ───
/** Platform-agnostic incoming message */
@@ -21,6 +40,8 @@ export interface ChannelMessage {
text: string;
/** Chat type: "direct" (1:1) or "group" */
chatType: "direct" | "group";
+ /** Optional media attachment (voice, image, video, document) */
+ media?: ChannelMediaAttachment | undefined;
}
// ─── Delivery Context ───
@@ -96,6 +117,8 @@ export interface ChannelPlugin {
readonly gateway: ChannelGatewayAdapter;
/** Message sending adapter */
readonly outbound: ChannelOutboundAdapter;
+ /** Download a media file to local disk (optional, platform-specific) */
+ downloadMedia?(fileId: string, accountId: string): Promise<string>;
}
// ─── Channels Config File Shape ───
diff --git a/src/shared/paths.ts b/src/shared/paths.ts
index 3d2e006b7d..3c047312b5 100644
--- a/src/shared/paths.ts
+++ b/src/shared/paths.ts
@@ -3,3 +3,6 @@ import { homedir } from "node:os";
/** Root data directory: ~/.super-multica */
export const DATA_DIR = join(homedir(), ".super-multica");
+
+/** Cache directory for downloaded media files */
+export const MEDIA_CACHE_DIR = join(DATA_DIR, "cache", "media");