refactor(validation): add dreaming directly to MemoryUpdateSchema

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
Dhravya 2026-10-27 17:14:24 +00:00
parent 0025cfe519
commit 3119e9e0d6
No known key found for this signature in database
GPG key ID: AB7AE7EA7D4AF7AD
2 changed files with 8 additions and 16 deletions

View file

@ -5,7 +5,6 @@ import {
DocumentsWithMemoriesQuerySchema,
ListMemoriesQuerySchema,
MemoryAddSchema,
MemoryUpdateSchema,
SearchRequestSchema,
Searchv4RequestSchema,
} from "./api"
@ -191,10 +190,4 @@ describe("document add schemas", () => {
.success,
).toBe(false)
})
it("does not add dreaming to update requests", () => {
expect(
MemoryUpdateSchema.parse({ content: "probe", dreaming: "instant" }),
).toEqual({ content: "probe" })
})
})

View file

@ -138,6 +138,12 @@ export const MemorySchema = z
example: exampleMemory,
})
export const DreamingSchema = z.enum(["dynamic", "instant"]).openapi({
description:
'Processing mode. "dynamic" (default) groups related documents together before extracting memories; "instant" processes each document on its own right away.',
example: "instant",
})
export const MemoryUpdateSchema = z.object({
containerTags: z
.array(z.string())
@ -157,6 +163,7 @@ export const MemoryUpdateSchema = z.object({
"Optional custom ID of the memory. This could be an ID from your database that will uniquely identify this memory.",
example: "mem_abc123",
}),
dreaming: DreamingSchema.optional(),
entityContext: z.string().max(1500).optional().openapi({
description:
"Context for memory extraction on this container tag. Helps guide how memories are extracted and understood.",
@ -170,15 +177,7 @@ export const MemoryUpdateSchema = z.object({
}),
})
export const DreamingSchema = z.enum(["dynamic", "instant"]).openapi({
description:
'Processing mode. "dynamic" (default) groups related documents together before extracting memories; "instant" processes each document on its own right away.',
example: "instant",
})
export const MemoryAddSchema = MemoryUpdateSchema.extend({
dreaming: DreamingSchema.optional(),
})
export const MemoryAddSchema = MemoryUpdateSchema
export const PaginationSchema = z
.object({