import { autoGlmLocate } from "./locate.mjs";
import { autoGlmPlanning } from "./planning.mjs";
import { getAutoGLMChineseLocatePrompt, getAutoGLMChinesePlanPrompt, getAutoGLMMultilingualLocatePrompt, getAutoGLMMultilingualPlanPrompt } from "./prompt.mjs";
const defaultAutoGlmReplanningCycleLimit = 100;
function createAutoGlmAdapter({ getPlanPrompt, getLocatePrompt }) {
    return {
        chatCompletion: {
            unsupportedUserConfig: [
                'reasoningEnabled',
                'reasoningEffort',
                'reasoningBudget'
            ],
            buildChatCompletionParams: ({ midsceneDefaults, userConfig })=>{
                const commonOverrideConfig = {};
                if (void 0 !== userConfig.temperature) commonOverrideConfig.temperature = userConfig.temperature;
                const modelSpecificConfig = {
                    top_p: 0.85,
                    frequency_penalty: 0.2
                };
                return {
                    config: {
                        ...midsceneDefaults,
                        ...commonOverrideConfig,
                        ...modelSpecificConfig
                    }
                };
            }
        },
        planning: {
            kind: 'custom',
            cacheEnabled: false,
            defaultReplanningCycleLimit: defaultAutoGlmReplanningCycleLimit,
            planFn: (userInstruction, options)=>autoGlmPlanning(userInstruction, options, getPlanPrompt)
        },
        locate: {
            kind: 'custom',
            locateFn: (elementDescription, options)=>autoGlmLocate(elementDescription, options, getLocatePrompt)
        }
    };
}
const autoGlmAdapters = {
    'auto-glm': createAutoGlmAdapter({
        getPlanPrompt: getAutoGLMChinesePlanPrompt,
        getLocatePrompt: getAutoGLMChineseLocatePrompt
    }),
    'auto-glm-multilingual': createAutoGlmAdapter({
        getPlanPrompt: getAutoGLMMultilingualPlanPrompt,
        getLocatePrompt: getAutoGLMMultilingualLocatePrompt
    })
};
export { autoGlmAdapters };

//# sourceMappingURL=adapter.mjs.map