/**
 * Best-effort wrapper around `getMainLoopModel()` for code paths
 * where a model-lookup failure must never propagate — e.g. the
 * fire-and-forget receipt emitter in FileEdit / FileWrite tools, or
 * the audit-log hook in runToolUse.
 *
 * Reasons this can throw:
 *   - Bootstrap state hasn't been initialized (tests, SDK resume
 *     race).
 *   - A misconfigured provider throws from the underlying selector.
 *
 * In all of those cases we prefer a missing `model` field on the
 * receipt/audit entry over killing the user-visible tool call.
 */

import { getMainLoopModel } from './model.js'

export function safeGetMainLoopModel(): string | undefined {
  try {
    return getMainLoopModel()
  } catch {
    return undefined
  }
}
