Files
gods-eye-view/src/hudSummaryResponse.js
T
Bilawal Sidhu b6da93b8ac release: v0.1.0 — one-click install, keyless boot, in-app Provider Settings (#142)
The first formal release.

- One-click install via Pinokio; keyless boot lands on a live Esri World
  Imagery satellite globe with keyless terrain, with automatic OSM fallback
  and graceful degradation when terrain is unavailable.
- Provider Settings (the POWER UP panel): add, replace, or remove API keys
  inside the app; credential files made owner-only before any secret is
  written; external keys shown read-only; the panel refuses shared or proxied
  servers.
- Keyless capability responses for the optional HUD summary and place search.
- Aircraft-identity voice answers cover operator, type, and route, and say so
  plainly when enrichment is unavailable.
- README rewritten keyless-first; concise 0.1.0 changelog section; CI
  workflow included.

Gates: 2,672 unit tests pass / 0 fail, build clean, tracking regression
108/108, map-source tray QA pass, setup doctor ready.
2026-08-31 17:49:45 -05:00

36 lines
1.2 KiB
JavaScript

export const HUD_SUMMARY_UNCONFIGURED_CODE = 'OPENAI_NOT_CONFIGURED';
/**
* Describe the optional HUD summary capability without turning a deliberately
* keyless boot into an HTTP failure.
*
* @param {unknown} apiKey - Candidate server-side OpenAI credential.
* @returns {{ statusCode: 200, payload: { configured: false, code: string, error: null, summary: null } }|null}
* A graceful unconfigured response, or null when the provider is configured.
*/
export function keylessHudSummaryResponse(apiKey) {
if (String(apiKey ?? '').trim()) return null;
return {
statusCode: 200,
payload: {
configured: false,
code: HUD_SUMMARY_UNCONFIGURED_CODE,
error: null,
summary: null,
},
};
}
/** Return true only for the deliberate, successful no-key capability response. */
export function isHudSummaryUnconfigured(status, data) {
const keys = data !== null && typeof data === 'object' && !Array.isArray(data)
? Object.keys(data)
: [];
return keys.length === 4
&& status === 200
&& data?.configured === false
&& data?.code === HUD_SUMMARY_UNCONFIGURED_CODE
&& data?.error === null
&& data?.summary === null;
}