import { shouldRecordSnapshotsWithNative, writeSnapshotViaHooksWithNative } from '../router/virtual-router/engine-selection/native-snapshot-hooks.js';
export function shouldRecordSnapshots() {
    return shouldRecordSnapshotsWithNative();
}
export async function writeSnapshotViaHooks(options) {
    writeSnapshotViaHooksWithNative({
        endpoint: options.endpoint,
        stage: options.stage,
        requestId: options.requestId,
        data: options.data,
        verbosity: options.verbosity,
        channel: options.channel,
        providerKey: options.providerKey,
        groupRequestId: options.groupRequestId
    });
}
export async function recordSnapshot(options) {
    if (!shouldRecordSnapshots())
        return;
    const endpoint = options.endpoint || '/v1/chat/completions';
    void writeSnapshotViaHooks({
        endpoint,
        stage: options.stage,
        requestId: options.requestId,
        providerKey: options.providerKey,
        groupRequestId: options.groupRequestId,
        data: options.data,
        verbosity: 'verbose'
    }).catch(() => {
        // ignore hook errors
    });
}
export function createSnapshotWriter(opts) {
    if (!shouldRecordSnapshots()) {
        return undefined;
    }
    const endpoint = opts.endpoint || '/v1/chat/completions';
    return (stage, payload) => {
        void recordSnapshot({
            stage,
            requestId: opts.requestId,
            endpoint,
            folderHint: opts.folderHint,
            providerKey: opts.providerKey,
            groupRequestId: opts.groupRequestId,
            data: payload
        });
    };
}
