import { errorBody } from "./routes.js";
export const LOCAL_CONVERSATION_MEMORY_USER_ID = "local-operator";
export function resolveConversationMemoryContext(deps, projectPath, chatId) {
    const chat = deps.store.listChats(projectPath).find((entry) => entry.id === chatId);
    if (chat === undefined) {
        return { status: 404, body: errorBody("NOT_FOUND", "Chat not found.") };
    }
    return {
        userId: LOCAL_CONVERSATION_MEMORY_USER_ID,
        workspaceId: projectPath,
        projectId: projectPath,
        conversationId: chat.id,
    };
}
export function conversationMemoryScopes(context) {
    return [
        { kind: "workspace", workspaceId: context.workspaceId },
        { kind: "project", projectId: context.projectId },
        { kind: "user", userId: context.userId },
        { kind: "global" },
    ];
}
