"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildWorkerStructuredContract = buildWorkerStructuredContract;
exports.toWorkerPromptJsonSchema = toWorkerPromptJsonSchema;
exports.renderWorkerPromptJsonSchemaForDisplay = renderWorkerPromptJsonSchemaForDisplay;
const zod_1 = require("zod");
function buildWorkerStructuredContract(input) {
    return {
        schema: input.schema,
        promptSchema: input.promptSchema ?? toWorkerPromptJsonSchema(input.schema),
        example: input.example,
        rules: input.rules,
    };
}
function toWorkerPromptJsonSchema(schema) {
    const jsonSchema = zod_1.z.toJSONSchema(schema, {
        io: "input",
    });
    delete jsonSchema.$schema;
    return jsonSchema;
}
function renderWorkerPromptJsonSchemaForDisplay(schema) {
    return JSON.stringify(schema);
}
