require("./rolldown-runtime-D_mwlA32.cjs");
let zod = require("zod");
//#region src/contracts/env.ts
const ProviderEnvOverridesSchema = zod.z.object({
	ABLIT_API_BASE_URL: zod.z.string().optional(),
	ABLIT_KEY: zod.z.string().optional(),
	AI21_API_BASE_URL: zod.z.string().optional(),
	AI21_API_KEY: zod.z.string().optional(),
	AIML_API_KEY: zod.z.string().optional(),
	ANTHROPIC_API_KEY: zod.z.string().optional(),
	ANTHROPIC_BASE_URL: zod.z.string().optional(),
	ATLASCLOUD_API_KEY: zod.z.string().optional(),
	AWS_BEARER_TOKEN_BEDROCK: zod.z.string().optional(),
	AWS_BEDROCK_REGION: zod.z.string().optional(),
	AZURE_API_BASE_URL: zod.z.string().optional(),
	AZURE_API_HOST: zod.z.string().optional(),
	AZURE_API_KEY: zod.z.string().optional(),
	AZURE_AUTHORITY_HOST: zod.z.string().optional(),
	AZURE_CLIENT_ID: zod.z.string().optional(),
	AZURE_CLIENT_SECRET: zod.z.string().optional(),
	AZURE_DEPLOYMENT_NAME: zod.z.string().optional(),
	AZURE_EMBEDDING_DEPLOYMENT_NAME: zod.z.string().optional(),
	AZURE_OPENAI_API_BASE_URL: zod.z.string().optional(),
	AZURE_OPENAI_API_HOST: zod.z.string().optional(),
	AZURE_OPENAI_API_KEY: zod.z.string().optional(),
	AZURE_OPENAI_BASE_URL: zod.z.string().optional(),
	AZURE_OPENAI_DEPLOYMENT_NAME: zod.z.string().optional(),
	AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME: zod.z.string().optional(),
	AZURE_TENANT_ID: zod.z.string().optional(),
	AZURE_TOKEN_SCOPE: zod.z.string().optional(),
	CLAUDE_CODE_USE_BEDROCK: zod.z.string().optional(),
	CLAUDE_CODE_USE_VERTEX: zod.z.string().optional(),
	CLOUDFLARE_ACCOUNT_ID: zod.z.string().optional(),
	CLOUDFLARE_API_KEY: zod.z.string().optional(),
	CLOUDFLARE_GATEWAY_ID: zod.z.string().optional(),
	CF_AIG_TOKEN: zod.z.string().optional(),
	COMETAPI_KEY: zod.z.string().optional(),
	COHERE_API_KEY: zod.z.string().optional(),
	COHERE_CLIENT_NAME: zod.z.string().optional(),
	DATABRICKS_TOKEN: zod.z.string().optional(),
	DATABRICKS_WORKSPACE_URL: zod.z.string().optional(),
	DOCKER_MODEL_RUNNER_BASE_URL: zod.z.string().optional(),
	DOCKER_MODEL_RUNNER_API_KEY: zod.z.string().optional(),
	ELEVENLABS_API_KEY: zod.z.string().optional(),
	FAL_KEY: zod.z.string().optional(),
	FIREWORKS_API_BASE_URL: zod.z.string().optional(),
	FIREWORKS_API_KEY: zod.z.string().optional(),
	GITHUB_TOKEN: zod.z.string().optional(),
	GOOGLE_API_HOST: zod.z.string().optional(),
	GOOGLE_API_BASE_URL: zod.z.string().optional(),
	GOOGLE_API_KEY: zod.z.string().optional(),
	GOOGLE_PROJECT_ID: zod.z.string().optional(),
	GOOGLE_LOCATION: zod.z.string().optional(),
	GOOGLE_GENERATIVE_AI_API_KEY: zod.z.string().optional(),
	GEMINI_API_KEY: zod.z.string().optional(),
	GROQ_API_KEY: zod.z.string().optional(),
	HELICONE_API_KEY: zod.z.string().optional(),
	HF_API_TOKEN: zod.z.string().optional(),
	HF_TOKEN: zod.z.string().optional(),
	HYPERBOLIC_API_KEY: zod.z.string().optional(),
	HUGGING_FACE_HUB_TOKEN: zod.z.string().optional(),
	JFROG_API_KEY: zod.z.string().optional(),
	LANGFUSE_HOST: zod.z.string().optional(),
	LANGFUSE_PUBLIC_KEY: zod.z.string().optional(),
	LANGFUSE_SECRET_KEY: zod.z.string().optional(),
	LITELLM_API_BASE: zod.z.string().optional(),
	LLAMA_BASE_URL: zod.z.string().optional(),
	LOCALAI_BASE_URL: zod.z.string().optional(),
	MISTRAL_API_BASE_URL: zod.z.string().optional(),
	MISTRAL_API_HOST: zod.z.string().optional(),
	MISTRAL_API_KEY: zod.z.string().optional(),
	MINIMAX_API_KEY: zod.z.string().optional(),
	MLFLOW_GATEWAY_API_KEY: zod.z.string().optional(),
	MLFLOW_GATEWAY_URL: zod.z.string().optional(),
	MODELSLAB_API_KEY: zod.z.string().optional(),
	N8N_API_KEY: zod.z.string().optional(),
	NSCALE_SERVICE_TOKEN: zod.z.string().optional(),
	NSCALE_API_KEY: zod.z.string().optional(),
	NOVITA_API_KEY: zod.z.string().optional(),
	NVIDIA_API_BASE_URL: zod.z.string().optional(),
	NVIDIA_API_KEY: zod.z.string().optional(),
	OLLAMA_API_KEY: zod.z.string().optional(),
	OLLAMA_BASE_URL: zod.z.string().optional(),
	OPENAI_API_BASE_URL: zod.z.string().optional(),
	OPENAI_API_HOST: zod.z.string().optional(),
	OPENAI_API_KEY: zod.z.string().optional(),
	OPENAI_BASE_URL: zod.z.string().optional(),
	OPENAI_ORGANIZATION: zod.z.string().optional(),
	CLAWDBOT_GATEWAY_PASSWORD: zod.z.string().optional(),
	CLAWDBOT_GATEWAY_TOKEN: zod.z.string().optional(),
	CLAWDBOT_GATEWAY_URL: zod.z.string().optional(),
	CODEX_API_KEY: zod.z.string().optional(),
	OPENCLAW_CONFIG_PATH: zod.z.string().optional(),
	OPENCLAW_GATEWAY_PASSWORD: zod.z.string().optional(),
	OPENCLAW_GATEWAY_PORT: zod.z.string().optional(),
	OPENCLAW_GATEWAY_TOKEN: zod.z.string().optional(),
	OPENCLAW_GATEWAY_URL: zod.z.string().optional(),
	ORCAROUTER_API_KEY: zod.z.string().optional(),
	PALM_API_HOST: zod.z.string().optional(),
	PALM_API_KEY: zod.z.string().optional(),
	PORTKEY_API_KEY: zod.z.string().optional(),
	PROMPTFOO_CA_CERT_PATH: zod.z.string().optional(),
	PROMPTFOO_PFX_CERT_PATH: zod.z.string().optional(),
	PROMPTFOO_PFX_PASSWORD: zod.z.string().optional(),
	PROMPTFOO_JKS_CERT_PATH: zod.z.string().optional(),
	PROMPTFOO_JKS_PASSWORD: zod.z.string().optional(),
	PROMPTFOO_JKS_ALIAS: zod.z.string().optional(),
	PROMPTFOO_INSECURE_SSL: zod.z.string().optional(),
	QUIVERAI_API_KEY: zod.z.string().optional(),
	REPLICATE_API_KEY: zod.z.string().optional(),
	REPLICATE_API_TOKEN: zod.z.string().optional(),
	SHAREPOINT_BASE_URL: zod.z.string().optional(),
	SHAREPOINT_CERT_PATH: zod.z.string().optional(),
	SHAREPOINT_CLIENT_ID: zod.z.string().optional(),
	SHAREPOINT_TENANT_ID: zod.z.string().optional(),
	VERCEL_AI_GATEWAY_API_KEY: zod.z.string().optional(),
	VERCEL_AI_GATEWAY_BASE_URL: zod.z.string().optional(),
	VERTEX_API_HOST: zod.z.string().optional(),
	VERTEX_API_KEY: zod.z.string().optional(),
	VERTEX_API_VERSION: zod.z.string().optional(),
	VERTEX_PROJECT_ID: zod.z.string().optional(),
	VERTEX_PUBLISHER: zod.z.string().optional(),
	VERTEX_REGION: zod.z.string().optional(),
	VOYAGE_API_BASE_URL: zod.z.string().optional(),
	VOYAGE_API_KEY: zod.z.string().optional(),
	WATSONX_AI_APIKEY: zod.z.string().optional(),
	WATSONX_AI_AUTH_TYPE: zod.z.string().optional(),
	WATSONX_AI_BEARER_TOKEN: zod.z.string().optional(),
	WATSONX_AI_PROJECT_ID: zod.z.string().optional(),
	XAI_API_BASE_URL: zod.z.string().optional(),
	XAI_API_KEY: zod.z.string().optional(),
	AZURE_CONTENT_SAFETY_ENDPOINT: zod.z.string().optional(),
	AZURE_CONTENT_SAFETY_API_KEY: zod.z.string().optional(),
	AZURE_CONTENT_SAFETY_API_VERSION: zod.z.string().optional(),
	AWS_REGION: zod.z.string().optional(),
	AWS_DEFAULT_REGION: zod.z.string().optional(),
	AWS_SAGEMAKER_MAX_TOKENS: zod.z.string().optional(),
	AWS_SAGEMAKER_TEMPERATURE: zod.z.string().optional(),
	AWS_SAGEMAKER_TOP_P: zod.z.string().optional(),
	AWS_SAGEMAKER_MAX_RETRIES: zod.z.string().optional(),
	PROMPTFOO_EVAL_TIMEOUT_MS: zod.z.string().optional()
});
//#endregion
//#region src/contracts/shared.ts
const CompletionTokenDetailsSchema = zod.z.object({
	reasoning: zod.z.number().optional(),
	acceptedPrediction: zod.z.number().optional(),
	rejectedPrediction: zod.z.number().optional(),
	cacheReadInputTokens: zod.z.number().optional(),
	cacheCreationInputTokens: zod.z.number().optional()
});
const TokenUsageCoreSchema = zod.z.object({
	prompt: zod.z.number().optional(),
	completion: zod.z.number().optional(),
	cached: zod.z.number().optional(),
	total: zod.z.number().optional(),
	numRequests: zod.z.number().optional(),
	completionDetails: CompletionTokenDetailsSchema.optional()
});
/** Token usage statistics. The optional `assertions` mirrors the top-level fields for model-graded assertion accounting. */
const BaseTokenUsageSchema = TokenUsageCoreSchema.extend({ assertions: TokenUsageCoreSchema.optional() });
const InputTypeValues = [
	"text",
	"pdf",
	"docx",
	"image"
];
const InputTypeSchema = zod.z.enum(InputTypeValues);
const DocxInjectionPlacementValues = [
	"body",
	"comment",
	"footnote",
	"header",
	"footer"
];
const DocxInjectionPlacementSchema = zod.z.enum(DocxInjectionPlacementValues);
const DocumentMediaInjectionPlacementValues = [
	"body",
	"header",
	"footer"
];
const DocumentMediaInjectionPlacementSchema = zod.z.enum(DocumentMediaInjectionPlacementValues);
const InputConfigSchema = zod.z.object({
	benign: zod.z.boolean().optional(),
	inputPurpose: zod.z.string().min(1, { error: "Input purpose must be a non-empty string" }).optional(),
	injectionPlacements: zod.z.array(zod.z.string().min(1, { error: "Injection placement must be a non-empty string" })).min(1, { error: "Injection placements must contain at least one placement" }).optional()
});
const InputDefinitionObjectSchema = zod.z.object({
	config: InputConfigSchema.optional(),
	description: zod.z.string().min(1, { error: "Input descriptions must be non-empty strings" }),
	type: InputTypeSchema.optional()
}).superRefine((input, ctx) => {
	const inputType = input.type ?? "text";
	const injectionPlacements = input.config?.injectionPlacements ?? [];
	if (inputType === "text" || injectionPlacements.length === 0) return;
	const placementSchema = inputType === "docx" ? DocxInjectionPlacementSchema : DocumentMediaInjectionPlacementSchema;
	const placementValues = inputType === "docx" ? DocxInjectionPlacementValues : DocumentMediaInjectionPlacementValues;
	const invalidPlacements = injectionPlacements.filter((placement) => !placementSchema.safeParse(placement).success);
	if (invalidPlacements.length > 0) ctx.addIssue({
		code: "custom",
		path: ["config", "injectionPlacements"],
		message: `Invalid ${inputType.toUpperCase()} injection placements: ${invalidPlacements.join(", ")}. Expected one of: ${placementValues.join(", ")}`
	});
});
const InputDefinitionSchema = zod.z.union([zod.z.string().min(1, { error: "Input descriptions must be non-empty strings" }), InputDefinitionObjectSchema]);
function normalizeInputDefinition(input) {
	if (typeof input === "string") return {
		description: input,
		type: "text"
	};
	return {
		config: input.config,
		description: input.description,
		type: input.type ?? "text"
	};
}
function normalizeInputs(inputs) {
	if (!inputs) return;
	return Object.fromEntries(Object.entries(inputs).map(([key, input]) => [key, normalizeInputDefinition(input)]));
}
function getInputDescription(input) {
	return typeof input === "string" ? input : input.description;
}
function getInputType(input) {
	return typeof input === "string" ? "text" : input.type ?? "text";
}
const NON_TEXT_INPUT_FORMAT_LABELS = {
	pdf: "PDF document",
	docx: "DOCX document",
	image: "image"
};
function buildInputPromptDescription(input) {
	const normalized = normalizeInputDefinition(input);
	const benignGuidance = normalized.config?.benign ? " Generate benign, natural, non-adversarial content for this input. Do not place attack instructions or policy-violating content here." : "";
	if (normalized.type === "text") return `${normalized.description}${benignGuidance}`;
	const formatLabel = NON_TEXT_INPUT_FORMAT_LABELS[normalized.type];
	return `${normalized.description} (format: ${formatLabel}; provide the text or instructions that should be embedded in the file)${benignGuidance}`;
}
const InputVariableNameSchema = zod.z.string().regex(/^[a-zA-Z_][a-zA-Z0-9_]*$/, { error: "Input variable names must be valid identifiers (start with letter or underscore)" });
const InputsSchema = zod.z.record(InputVariableNameSchema, InputDefinitionSchema);
//#endregion
//#region src/contracts/validators/prompts.ts
const PromptConfigSchema = zod.z.object({
	prefix: zod.z.string().optional(),
	suffix: zod.z.string().optional()
});
const PromptFunctionSchema = zod.z.custom((v) => typeof v === "function");
const PromptSchema = zod.z.object({
	id: zod.z.string().optional(),
	raw: zod.z.string(),
	template: zod.z.string().optional(),
	display: zod.z.string().optional(),
	label: zod.z.string(),
	function: PromptFunctionSchema.optional(),
	config: zod.z.any().optional()
});
function assert() {}
assert();
assert();
assert();
//#endregion
Object.defineProperty(exports, "BaseTokenUsageSchema", {
	enumerable: true,
	get: function() {
		return BaseTokenUsageSchema;
	}
});
Object.defineProperty(exports, "CompletionTokenDetailsSchema", {
	enumerable: true,
	get: function() {
		return CompletionTokenDetailsSchema;
	}
});
Object.defineProperty(exports, "DocumentMediaInjectionPlacementSchema", {
	enumerable: true,
	get: function() {
		return DocumentMediaInjectionPlacementSchema;
	}
});
Object.defineProperty(exports, "DocumentMediaInjectionPlacementValues", {
	enumerable: true,
	get: function() {
		return DocumentMediaInjectionPlacementValues;
	}
});
Object.defineProperty(exports, "DocxInjectionPlacementSchema", {
	enumerable: true,
	get: function() {
		return DocxInjectionPlacementSchema;
	}
});
Object.defineProperty(exports, "DocxInjectionPlacementValues", {
	enumerable: true,
	get: function() {
		return DocxInjectionPlacementValues;
	}
});
Object.defineProperty(exports, "InputConfigSchema", {
	enumerable: true,
	get: function() {
		return InputConfigSchema;
	}
});
Object.defineProperty(exports, "InputDefinitionObjectSchema", {
	enumerable: true,
	get: function() {
		return InputDefinitionObjectSchema;
	}
});
Object.defineProperty(exports, "InputDefinitionSchema", {
	enumerable: true,
	get: function() {
		return InputDefinitionSchema;
	}
});
Object.defineProperty(exports, "InputTypeSchema", {
	enumerable: true,
	get: function() {
		return InputTypeSchema;
	}
});
Object.defineProperty(exports, "InputTypeValues", {
	enumerable: true,
	get: function() {
		return InputTypeValues;
	}
});
Object.defineProperty(exports, "InputsSchema", {
	enumerable: true,
	get: function() {
		return InputsSchema;
	}
});
Object.defineProperty(exports, "PromptConfigSchema", {
	enumerable: true,
	get: function() {
		return PromptConfigSchema;
	}
});
Object.defineProperty(exports, "PromptSchema", {
	enumerable: true,
	get: function() {
		return PromptSchema;
	}
});
Object.defineProperty(exports, "ProviderEnvOverridesSchema", {
	enumerable: true,
	get: function() {
		return ProviderEnvOverridesSchema;
	}
});
Object.defineProperty(exports, "buildInputPromptDescription", {
	enumerable: true,
	get: function() {
		return buildInputPromptDescription;
	}
});
Object.defineProperty(exports, "getInputDescription", {
	enumerable: true,
	get: function() {
		return getInputDescription;
	}
});
Object.defineProperty(exports, "getInputType", {
	enumerable: true,
	get: function() {
		return getInputType;
	}
});
Object.defineProperty(exports, "normalizeInputDefinition", {
	enumerable: true,
	get: function() {
		return normalizeInputDefinition;
	}
});
Object.defineProperty(exports, "normalizeInputs", {
	enumerable: true,
	get: function() {
		return normalizeInputs;
	}
});

//# sourceMappingURL=prompts-BpCc1Nyq.cjs.map