Files
openclaw/ui/src/build-info.ts
T
Peter Steinberger 5d80b62d21 fix(ui): nudge stale tabs after gateway updates (#111619)
* fix(ui): nudge stale tabs after gateway updates

* fix(ui): resolve external packages in worktrees
2026-07-20 01:51:22 -07:00

24 lines
1005 B
TypeScript

// Compile-time identity for the Control UI artifact.
import { normalizeControlUiBuildInfo } from "./build-info-normalizers.ts";
import type { ControlUiBuildInfo } from "./build-info-types.ts";
export type { ControlUiBuildInfo } from "./build-info-types.ts";
declare global {
// Vite replaces this property with one object so the UI and service worker
// share the exact artifact identity without separate compile-time constants.
var OPENCLAW_CONTROL_UI_BUILD_INFO: ControlUiBuildInfo | undefined;
}
const injectedBuildInfo = globalThis.OPENCLAW_CONTROL_UI_BUILD_INFO;
export const CONTROL_UI_BUILD_INFO = normalizeControlUiBuildInfo(injectedBuildInfo);
export function controlUiVersionDiffersFrom(gatewayVersion: string | undefined): boolean {
const controlUiVersion = CONTROL_UI_BUILD_INFO.version?.trim();
const normalizedGatewayVersion = gatewayVersion?.trim();
return Boolean(
controlUiVersion && normalizedGatewayVersion && controlUiVersion !== normalizedGatewayVersion,
);
}