'use server';
import { resolve } from '../../lib/server-container.js';
import { revalidatePath } from 'next/cache';
import { requireFeatureFlag } from '../../lib/feature-flags.js';
export async function saveAgentPrompt(input) {
    try {
        requireFeatureFlag('collaboration');
        const useCase = resolve('UpsertAgentPromptOverrideUseCase');
        await useCase.execute({
            agentType: input.agentType,
            promptId: input.promptId,
            body: input.body,
        });
        revalidatePath(`/agents/${input.agentType}`);
        revalidatePath('/agents');
        return { ok: true };
    }
    catch (error) {
        return {
            ok: false,
            error: error instanceof Error ? error.message : 'Failed to save prompt',
        };
    }
}
export async function resetAgentPrompt(input) {
    try {
        requireFeatureFlag('collaboration');
        const useCase = resolve('DeleteAgentPromptOverrideUseCase');
        await useCase.execute(input);
        revalidatePath(`/agents/${input.agentType}`);
        revalidatePath('/agents');
        return { ok: true };
    }
    catch (error) {
        return {
            ok: false,
            error: error instanceof Error ? error.message : 'Failed to reset prompt',
        };
    }
}
