Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465import { tagged, } from '@monochromatic-dev/module-logger/ts';
import type { GeminiModel, } from './types.ts';
/** Logger root for image-diff after removing the package log shim. @example ```ts const rl = tagged({ tag: someFunction.name, l, },); ``` */const l = tagged({ tag: 'image-diff', },);
/** Gemini API base URL for embedding endpoints. */export const GEMINI_API_BASE = 'https://generativelanguage.googleapis.com/v1beta/models';
/** Default Gemini model; latest multimodal embedding preview. */export const DEFAULT_GEMINI_MODEL: GeminiModel = 'gemini-embedding-2-preview';
/** Resolve the Gemini API key from config or environment. @param configKey - explicitly provided API key, if any @returns resolved API key @throws when no API key is available from either source @example ```ts const key = resolveGeminiApiKey(undefined); ``` */export function resolveGeminiApiKey(configKey?: string,): string { /** Logger pre-tagged with this function's name so call-site context is preserved across debug lines. */ const rl = tagged({ tag: resolveGeminiApiKey.name, l, },); /** Resolved key from explicit config, then preferred env var, then fallback env var; blank triggers the explicit error. */ const key = configKey ?? process .env .IMAGE_DIFF_GEMINI_API_KEY ?? process .env .GEMINI_API_KEY; if ((key === undefined) || (key === '')) { throw new Error( 'Gemini API key is required. Provide it via config.apiKey or set IMAGE_DIFF_GEMINI_API_KEY (or GEMINI_API_KEY) environment variable.', ); } rl.debug('Gemini API key resolved',); return key;}