const require_invariant = require("./invariant-KxYLhw_b.cjs");
const require_accounts = require("./accounts-CibSkI-0.cjs");
const require_promptfoo = require("./promptfoo-DNUR0HDo.cjs");
const require_simulatedUser = require("./simulatedUser-CvzlkU_c.cjs");
const require_shared = require("./shared-uRkDny0q.cjs");
//#region src/redteam/providers/mischievousUser.ts
const PROVIDER_ID = "promptfoo:redteam:mischievous-user";
var RedteamMischievousUserProvider = class extends require_simulatedUser.SimulatedUser {
	taskId = require_promptfoo.REDTEAM_SIMULATED_USER_TASK_ID;
	constructor(config) {
		require_invariant.invariant(config.injectVar, "Expected injectVar to be set");
		let maxTurns = config.maxTurns ?? 5;
		if (!require_accounts.isLoggedIntoCloud()) maxTurns = Math.min(maxTurns, 10);
		super({
			id: PROVIDER_ID,
			config: {
				instructions: `{{${config.injectVar}}}`,
				maxTurns,
				stateful: config.stateful ?? false
			}
		});
	}
	id() {
		return PROVIDER_ID;
	}
	serializeOutput(messages, tokenUsage, finalTargetResponse, sessionId) {
		const finalPrompt = require_shared.getLastMessageContent(messages, "user") || "";
		return {
			output: require_shared.getLastMessageContent(messages, "assistant") || "",
			prompt: finalPrompt,
			tokenUsage,
			metadata: {
				redteamFinalPrompt: finalPrompt,
				messages,
				redteamHistory: require_shared.messagesToRedteamHistory(messages),
				sessionId
			},
			guardrails: finalTargetResponse?.guardrails,
			sessionId
		};
	}
};
//#endregion
exports.default = RedteamMischievousUserProvider;

//# sourceMappingURL=mischievousUser-DOGOWx3S.cjs.map