diff --git a/services/platform-service/src/modules/memory/memory.test.ts b/services/platform-service/src/modules/memory/memory.test.ts index db189a15..9a400866 100644 --- a/services/platform-service/src/modules/memory/memory.test.ts +++ b/services/platform-service/src/modules/memory/memory.test.ts @@ -40,6 +40,21 @@ describe('CreateMemoryItemSchema', () => { expect(result.data.captureSurface).toBe('app'); } }); + + it('accepts media refs', () => { + const result = CreateMemoryItemSchema.safeParse({ + rawContent: 'voice transcript', + sourceType: 'voice', + media: { + audio: { + container: 'audio', + blobName: 'lysnrai/usr_1/audio/test.caf', + contentType: 'audio/x-caf', + }, + }, + }); + expect(result.success).toBe(true); + }); }); describe('ReassignMemoryItemSchema', () => { @@ -60,4 +75,3 @@ describe('PatchMemoryItemSchema', () => { expect(result.success).toBe(false); }); }); - diff --git a/services/platform-service/src/modules/memory/routes.ts b/services/platform-service/src/modules/memory/routes.ts index 7522061d..201193ee 100644 --- a/services/platform-service/src/modules/memory/routes.ts +++ b/services/platform-service/src/modules/memory/routes.ts @@ -85,6 +85,7 @@ export async function memoryRoutes(app: FastifyInstance) { rawContent: input.rawContent, triageResult: triage, brainIds, + ...(input.media && { media: input.media }), ...(input.reminderAt && { reminderAt: input.reminderAt }), actedOn: false, actedOnAt: null, diff --git a/services/platform-service/src/modules/memory/types.ts b/services/platform-service/src/modules/memory/types.ts index 4696036e..714d8760 100644 --- a/services/platform-service/src/modules/memory/types.ts +++ b/services/platform-service/src/modules/memory/types.ts @@ -33,6 +33,18 @@ export const TriageResultSchema = z.object({ suggestedActions: z.array(z.string().min(1).max(256)).default([]), }); +export const BlobRefSchema = z.object({ + container: z.string().min(1).max(64), + blobName: z.string().min(1).max(1024), + contentType: z.string().min(1).max(128).optional(), + size: z.number().int().min(0).optional(), +}); + +export const MediaRefsSchema = z.object({ + audio: BlobRefSchema.optional(), + image: BlobRefSchema.optional(), +}); + export const ListMemoryItemsQuerySchema = z.object({ productId: z.string().min(1).max(64).optional(), brainId: z.string().min(1).max(128).optional(), @@ -48,6 +60,7 @@ export const CreateMemoryItemSchema = z.object({ rawContent: z.string().min(1).max(50_000), triageResult: TriageResultSchema.optional(), brainIds: z.array(z.string().min(1).max(128)).optional(), + media: MediaRefsSchema.optional(), isSensitive: z.boolean().optional(), reminderAt: z .string() @@ -68,6 +81,8 @@ export const PatchMemoryItemSchema = z.object({ }); export type TriageResult = z.infer; +export type BlobRef = z.infer; +export type MediaRefs = z.infer; export type MemoryItemDoc = { id: string; @@ -78,6 +93,7 @@ export type MemoryItemDoc = { rawContent: string; triageResult: TriageResult; brainIds: string[]; + media?: MediaRefs; reminderAt?: string; actedOn: boolean; actedOnAt: string | null; @@ -87,4 +103,3 @@ export type MemoryItemDoc = { createdAt: string; updatedAt: string; }; -