import { jsx as _jsx } from "react/jsx-runtime";
import { AgentPlayground } from './agent-playground.js';
const meta = {
    title: 'AgentEditor/AgentPlayground',
    component: AgentPlayground,
    parameters: { layout: 'padded' },
    decorators: [
        (Story) => (_jsx("div", { className: "max-w-2xl", children: _jsx(Story, {}) })),
    ],
};
export default meta;
function fakeStreamingFetch(chunks) {
    return (async () => {
        const encoder = new TextEncoder();
        const stream = new ReadableStream({
            async start(controller) {
                for (const chunk of chunks) {
                    controller.enqueue(encoder.encode(`data: ${JSON.stringify({ type: 'delta', content: chunk })}\n\n`));
                    await new Promise((r) => setTimeout(r, 80));
                }
                controller.enqueue(encoder.encode(`data: ${JSON.stringify({ type: 'done', content: '' })}\n\n`));
                controller.close();
            },
        });
        return new Response(stream, { status: 200, headers: { 'content-type': 'text/event-stream' } });
    });
}
export const Default = {
    args: {
        agentType: 'feature-agent',
        promptId: 'implement.system',
        fetchOverride: fakeStreamingFetch([
            'Sure — ',
            'here is a plan for that feature.\n\n',
            '1. Read the spec\n',
            '2. Write tests\n',
            '3. Implement',
        ]),
    },
};
export const WithInlineOverride = {
    args: {
        agentType: 'supervisor-agent',
        promptId: 'evaluator.system',
        inlinePromptBody: 'NEW SUPERVISOR PROMPT (unsaved)',
        fetchOverride: fakeStreamingFetch(['Verdict: advise. Reason: looks fine.']),
    },
};
