feat(memory): allow editing scope and project on memory.update

Extends both the Web UI edit form and the memory.update MCP tool so
existing memories can be reclassified between user-global and
project-attached scopes without delete+rewrite. Schema refines enforce
the user/project consistency invariants; audit log captures from/to
scope and projectKey on transitions.
This commit is contained in:
2026-05-17 06:43:19 -07:00
parent af5e7c4680
commit d65e1cb351
4 changed files with 199 additions and 17 deletions
+19 -3
View File
@@ -46,9 +46,25 @@ export const MemoryUpdateInput = z.object({
id: z.string().uuid(),
content: MemoryContent.optional(),
tags: Tags.optional(),
}).refine((v) => v.content !== undefined || v.tags !== undefined, {
message: "memory.update requires content or tags",
});
scope: MemoryScope.optional(),
project: ProjectKey.optional(),
})
.refine(
(v) =>
v.content !== undefined ||
v.tags !== undefined ||
v.scope !== undefined ||
v.project !== undefined,
{ message: "memory.update requires content, tags, scope, or project" },
)
.refine(
(v) => v.scope !== "project" || (v.project !== undefined && v.project !== ""),
{ message: "scope='project' requires a non-empty project key" },
)
.refine(
(v) => v.scope !== "user" || v.project === undefined || v.project === "",
{ message: "scope='user' cannot have a project key" },
);
export type MemoryUpdateInput = z.infer<typeof MemoryUpdateInput>;
export const MemorySearchInput = z.object({