import { HttpAgent } from '@ag-ui/client';
import { buildBaseAnswerGenerationUrl } from '../endpoint-url-builder.js';
/**
 * Custom HTTP Agent for answer requests
 */
export class AnswerAgent extends HttpAgent {
    requestInit(input) {
        const { params, accessToken } = input.forwardedProps || {};
        return {
            method: 'POST',
            headers: {
                ...this.headers,
                Authorization: `Bearer ${accessToken}`,
                'Content-Type': 'application/json',
                Accept: 'text/event-stream',
            },
            body: JSON.stringify(params),
            signal: this.abortController.signal,
        };
    }
}
export const createAnswerAgent = (agentId, organizationId, env) => new AnswerAgent({
    url: `${buildBaseAnswerGenerationUrl(agentId, organizationId, env)}/answer`,
});
