import { IMPOSSIBLE, VersionInfo } from '@start9labs/start-sdk'

/**
 * v1.2.0:7 — SparkControl AI provider + base-URL footgun fix (2026-06-19).
 *
 * Adds a 6th AI provider, "SparkControl (local)" — the operator's own
 * self-hosted local-inference gateway. Its LLM surface is OpenAI-compatible,
 * so it reuses the OpenAI-style streamer, with two twists: no API key (keyless
 * on the LAN) and reached over the internal same-box StartOS address
 * (http://spark-control.startos:9999/v1, plain HTTP — no TLS games). The
 * Settings UI auto-detects the loaded vLLM model via SparkControl's
 * /api/endpoints discovery, mirroring the Ollama auto-detect.
 *
 * Also fixes a config footgun: a base URL could ride along to a fixed-URL
 * provider (Claude/OpenAI/Gemini) whose form field is hidden — stored but
 * silently ignored by the provider, which always hits its hardcoded endpoint.
 * Both config write paths now drop a base URL for non-custom-URL providers,
 * and the form clears it on provider change.
 *
 * No schema or data change: `AIConfigProfile.provider` is a free-text column,
 * so the new value needs no migration. Existing configs are untouched.
 */
export const v_1_2_0_7 = VersionInfo.of({
  version: '1.2.0:7',
  releaseNotes: {
    en_US:
      'New AI provider: SparkControl — your self-hosted local-inference gateway. Reached over the same-box address with no API key; the model is auto-detected. Also fixes a bug where a custom base URL could attach to a fixed-URL provider (Claude/OpenAI/Gemini) and be silently ignored. No data changes.',
  },
  migrations: {
    up: async () => {},
    down: IMPOSSIBLE,
  },
})
