export type KomodoPortFailure = | 'unconfigured' | 'no-name' | 'unreachable' | 'http-error' | 'unparseable' | 'no-udp-in-response'; /** Short fix hint per failure reason, shown under the Komodo probe result. */ export function komodoFixHint(reason: KomodoPortFailure, httpStatus?: number): string { switch (reason) { case 'unconfigured': return 'Set KOMODO_ADDRESS, KOMODO_API_KEY, and KOMODO_API_SECRET in the container env.'; case 'no-name': return 'This server row has no komodo_name — set it via SQL or via the fleet config.'; case 'unreachable': return 'Network, DNS, or timeout. Check that KOMODO_ADDRESS is reachable from this container.'; case 'http-error': if (httpStatus === 401 || httpStatus === 403) return 'Auth rejected — verify KOMODO_API_KEY and KOMODO_API_SECRET.'; if (httpStatus === 404) return 'Endpoint or deployment not found — check komodo_name matches the Komodo UI exactly.'; return `Komodo returned ${httpStatus ?? 'an error'}. Check the endpoint path and credentials.`; case 'unparseable': return 'Response was not JSON — is KOMODO_ADDRESS pointing at the Core API (not the Periphery)?'; case 'no-udp-in-response': return 'Parsed the response but no UDP port matched our known shapes. See the snippet below and extend extractUdpPort.'; } }