Files
iios/packages/iios-contracts/src/ingest.ts
T
maaz519 b164ef945c feat(mail): in-app attachments on internal mail + surface media parts in thread reads
- MailInternalDto accepts attachments[]; deposit() stores each as a media
  part (image/video→MEDIA_REF, audio→VOICE_REF, else FILE_REF)
- ingest now persists part sizeBytes; contract + DTO carry it
- threads.getMessages returns mimeType + sizeBytes so mail readers can
  render inline images / file chips
- test: internal mail stores an image attachment as a MEDIA_REF part

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 17:24:49 +05:30

46 lines
1.2 KiB
TypeScript

import type { ScopeVector } from './scope';
import type { HandleKind, InteractionKind, MessagePartKind } from './enums';
/**
* The ingest API contract (Data Model §11 OpenAPI `IngestInteractionRequest`).
* A trusted host app or channel adapter posts this to `/v1/interactions/ingest`.
*/
export interface IngestInteractionRequest {
scope: ScopeVector;
channel: {
type: string; // PORTAL, EMAIL, WHATSAPP, ...
externalChannelId?: string;
capabilityContract?: Record<string, unknown>;
};
source: {
handleKind: HandleKind;
externalId: string;
displayName?: string;
};
kind?: InteractionKind;
thread?: {
externalThreadId?: string;
subject?: string;
};
parts: Array<{
kind: MessagePartKind;
bodyText?: string;
contentRef?: string;
mimeType?: string;
sizeBytes?: number;
}>;
occurredAt: string;
providerEventId?: string;
/** Optional trace id to carry onto the created interaction (e.g. from an adapter). */
traceId?: string;
metadata?: Record<string, unknown>;
}
export interface IngestInteractionResponse {
interactionId: string;
sourceHandleId: string;
threadId: string;
state: string;
next: string[];
}